Hi Kyriako,

Thinking about your original approach of using compute tasks assigned to
nodes with all CATEGORIES required by the task to be local, I believe you
could use the affinity interface to figure this out. You'd need to partition
your CATEGORIES cache and use the CATEGORY ID as the affinity, then use the
Affinity interface to determine which node a CATEGORY is mapped to and
allocate same-node categories to tasks. Then you can direct this task to the
correct node and force local query.

IgniteCache cache = ignite.cache(cacheName);
Affinity aff = ignite.affinity(cacheName);
// Get Partition ID for a given Key
int partId = aff.partition(categoryId);
// Get Primary node id from Key. This is the one you need probably
int nodeId = aff.mapKeysToNodes(categoryId);

Javadoc:
https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/cache/affinity/Affinity.html#mapKeysToNodes(java.util.Collection)

I still think the original approach I suggested is easier and makes more
sense...




--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Distributed-Closures-VS-Executor-Service-tp11192p11817.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Reply via email to