Event Listeners for Hazelcast Clients
You can add event listeners to Hazelcast clients. You can configure the following listeners to listen to the events on the client side:
-
Lifecycle Listener: Notifies when the client is starting, started, shutting down and shutdown.
-
Membership Listener: Notifies when a member joins to/leaves the cluster to which the client is connected, or when an attribute is changed in a member.
-
Distributed Object Listener: Notifies when a distributed object is created or destroyed throughout the cluster to which the client is connected. Also notifies for the events happening in the distributed data structures, e.g., entry, item and message listeners.
For Hazelcast Java client example code/configuration snippets, see the sections of the current chapter, i.e., Distributed Events. See also the Configuring Client Listeners section for more information.
Follow the below links to learn how to configure the event listeners on other Hazelcast clients:
Note that you can simply add a listener to your client that you already configured
and registered on the member side. You do not need to configure the listener on the client.
Assuming that you implemented a listener for a map, .e.g., MyListener
on the member side,
see the following example for a Java client:
IMap<Object, Object> map = client.getMap("mymap");
map.addEntryListener(new MyListener(), true);
As you see, no configuration is needed.