LATEST VERSION: 9.1.1 - CHANGELOG
Pivotal GemFire® v9.1

List of Event Handlers and Events

GemFire provides many types of events and event handlers to help you manage your different data and application needs.

Event Handlers

Use either cache handlers or membership handlers in any single application. Do not use both. The event handlers in this table are cache handlers unless otherwise noted.

Handler API Events received Description
AsyncEventListener AsyncEvent

Tracks changes in a region for write-behind processing. Extends th CacheCallback interface. You install a write-back cache listener to an AsyncEventQueue instance. You can then add the AsyncEventQueue instance to one or more regions for write-behind processing. See [Implementing an AsyncEventListener for Write-Behind Cache Event Handling](implementing_write_behind_event_handler.html#implementing_write_behind_cache_event_handling).

CacheCallback   Superinterface of all cache event listeners. Functions only to clean up resources that the callback allocated.
CacheListener RegionEvent, EntryEvent Tracks changes to region and its data entries. Responds synchronously. Extends CacheCallback interface. Installed in region. Receives only local cache events. Install one in every member where you want the events handled by this listener. In a partitioned region, the cache listener only fires in the primary data store. Listeners on secondaries are not fired.
CacheWriter RegionEvent, EntryEvent Receives events for pending changes to the region and its data entries in this member or one of its peers. Has the ability to abort the operations in question. Extends CacheCallback interface. Installed in region. Receives events from anywhere in the distributed region, so you can install one in one member for the entire distributed region. Receives events only in primary data store in partitioned regions, so install one in every data store.
ClientMembershipListener

(org.apache.geode.management .membership.ClientMembershipListener)

ClientMembershipEvent One of the interfaces that replaces the deprecated Admin APIs. You can use the ClientMembershipListener to receive membership events only about clients. This listener’s callback methods are invoked when this process detects connection changes to clients. Callback methods include memberCrashed, memberJoined, memberLeft (graceful exit).
CqListener CqEvent Receives events from the server cache that satisfy a client-specified query. Extends CacheCallback interface. Installed in the client inside a CqQuery.
GatewayConflictResolver TimestampedEntryEvent Decides whether to apply a potentially conflicting event to a region that is distributed over a WAN configuration. This event handler is called only when the distributed system ID of an update event is different from the ID that last updated the region entry.
MembershipListener

(org.apache.geode.management .membership.MembershipListener)

MembershipEvent Use this interface to receive membership events only about peers. This listener’s callback methods are invoked when peer members join or leave the GemFire distributed system. Callback methods include memberCrashed, memberJoined, and memberLeft (graceful exit).
RegionMembershipListener RegionEvent Provides after-event notification when a region with the same name has been created in another member and when other members hosting the region join or leave the distributed system. Extends CacheCallback and CacheListener. Installed in region as a CacheListener.
TransactionListener TransactionEvent with embedded list of EntryEvent Tracks the outcome of transactions and changes to data entries in the transaction.
**Note:**

Multiple transactions on the same cache can cause concurrent invocation of TransactionListener methods, so implement methods that do the appropriate synchronizing of the multiple threads for thread-safe operation.

Extends CacheCallback interface. Installed in cache using transaction manager. Works with region-level listeners if needed.
TransactionWriter TransactionEvent with embedded list of EntryEvent Receives events for pending transaction commits. Has the ability to abort the transaction. Extends CacheCallback interface. Installed in cache using transaction manager. At most one writer is called per transaction. Install a writer in every transaction host.
UniversalMembershipListenerAdapter

(org.apache.geode .management.membership .UniversalMembershipListenerAdapter)

MembershipEvent and ClientMembershipEvent One of the interfaces that replaces the deprecated Admin APIs. Provides a wrapper for MembershipListener and ClientMembershipListener callbacks for both clients and peers.

Events

The events in this table are cache events unless otherwise noted.

Event Passed to handler … Description
AsyncEvent AsyncEventListener Provides information about a single event in the cache for asynchronous, write-behind processing.
CacheEvent Superinterface to RegionEvent and EntryEvent. This defines common event methods, and contains data needed to diagnose the circumstances of the event, including a description of the operation being performed, information about where the event originated, and any callback argument passed to the method that generated this event.
ClientMembershipEvent ClientMembershipListener An event delivered to a ClientMembershipListener when this process detects connection changes to servers or clients.
CqEvent CqListener Provides information about a change to the results of a continuous query running on a server on behalf of a client. CqEvents are processed on the client.
EntryEvent CacheListener, CacheWriter, TransactionListener (inside the TransactionEvent) Extends CacheEvent for entry events. Contains information about an event affecting a data entry in the cache. The information includes the key, the value before this event, and the value after this event. EntryEvent.getNewValue returns the current value of the data entry. EntryEvent.getOldValue returns the value before this event if it is available. For a partitioned region, returns the old value if the local cache holds the primary copy of the entry. EntryEvent provides the GemFire transaction ID if available.

You can retrieve serialized values from EntryEvent using the getSerialized* methods. This is useful if you get values from one region’s events just to put them into a separate cache region. There is no counterpart put function as the put recognizes that the value is serialized and bypasses the serialization step.

MembershipEvent (membership event) MembershipListener

An event that describes the member that originated this event. Instances of this are delivered to a MembershipListener when a member has joined or left the distributed system.

RegionEvent CacheListener, CacheWriter, RegionMembershipListener Extends CacheEvent for region events. Provides information about operations that affect the whole region, such as reinitialization of the region after being destroyed.
TimestampedEntryEvent GatewayConflictResolver Extends EntryEvent to include a timestamp and distributed system ID associated with the event. The conflict resolver can compare the timestamp and ID in the event with the values stored in the entry to decide whether the local system should apply the potentially conflicting event.
TransactionEvent TransactionListener, TransactionWriter Describes the work done in a transaction. This event may be for a pending or committed transaction, or for the work abandoned by an explicit rollback or failed commit. The work is represented by an ordered list of EntryEvent instances. The entry events are listed in the order in which the operations were performed in the transaction.

As the transaction operations are performed, the entry events are conflated, with only the last event for each entry remaining in the list. So if entry A is modified, then entry B, then entry A, the list will contain the event for entry B followed by the second event for entry A.