Normally (without @AffinityKeyMapped) Ignite will use CustomerKey hash code
(not object hashCode()) to find a partition. Ignite will colsult with
AffinityFunction (partition() method) and to what partition put key and with
assignPartitions find concrete node that holds that partition.

In other hand, if you annotate some field with @AffinityKeyMapped, value
from that field would be used for mapping to partition. In your case, I
suppose, you need to map a field that is common to your keys, by what you
can group into one partition. For example, if you set annotation to customer
name will mean that keys with the same customer name will always hit the
same partition.

AffinityFunction does two things: maps partitions to nodes and keys to
partitions. If you override RendezvousAffinityFunction in that way, when
partitions 1-4 will go to node 1, you need to make sure that your keys will
fall into that partitions.

You may start with annotation first (this process named affinity
co-location, when some related keys put into same partition), I think that
is what you need.

Affinity implementation is set in CacheConfiguration.setAffinity().

Thanks!
-Dmitry



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Reply via email to