Distributed Events

You can register for Hazelcast entry events so you will be notified when those events occur. Event Listeners are cluster-wide so when a listener is registered in one member of cluster, it is actually registering for events originated at any member in the cluster. When a new member joins, events originated at the new member will also be delivered.

An Event is created only if you registered an event listener. If no listener is registered, then no event will be created. If you provided a predicate when you registered the event listener, pass the predicate before sending the event to the listener (node/client).

As a rule of thumb, your event listener should not implement heavy processes in its event methods which block the thread for a long time. If needed, you can use ExecutorService to transfer long running processes to another thread and offload the current listener thread.

Event Listeners

  • MembershipListener for cluster membership events
  • DistributedObjectListener for distributed object creation and destroy events
  • MigrationListener for partition migration start and complete events
  • LifecycleListener for HazelcastInstance lifecycle events
  • EntryListener for IMap and MultiMap entry events
  • ItemListener for IQueue, ISet and IList item events (please refer to the Event Registration and Configuration parts of the sections Set and List).
  • MessageListener for ITopic message events
  • ClientListener for client connection events