D. Hill
D. Hill

Reputation: 103

Can i add a listener to an individual <key, value> pair in Hazelcast?

I'm aware that Hazelcast has the functionality to add EntryListener to a map (IMap) that I am updating such that i receive messages based on activity to the whole map.

However I want to know if it is possible to add a listener to an individual key and its value. I.e. a listener to one entry of the map, not the whole map.

Thanks

Upvotes: 1

Views: 357

Answers (1)

noctarius
noctarius

Reputation: 6094

You have two different options. You can register an MapListener to a specific key or you can define a Predicate.

IMap::addEntryListener(MapListener, Key, boolean)
IMap::addEntryListener(MapListener, Predicate, boolean)

http://docs.hazelcast.org/docs/3.6/javadoc/com/hazelcast/core/IMap.html#addEntryListener(com.hazelcast.core.EntryListener,%20K,%20boolean)

http://docs.hazelcast.org/docs/3.6/javadoc/com/hazelcast/core/IMap.html#addEntryListener(com.hazelcast.core.EntryListener,%20com.hazelcast.query.Predicate,%20boolean)

Upvotes: 1

Related Questions