GemFire 7.0

Interface AsyncEventListener

All Superinterfaces:

public interface AsyncEventListener
extends CacheCallback

A callback for events passing through the AsyncEventQueue to which this listener is attached. Implementers of interface AsyncEventListener process batches of AsyncEvent delivered by the corresponding AsyncEventQueue.
A sample implementation of this interface is as follows:

 public class MyEventListener implements AsyncEventListener {
      public boolean processEvents(List events) {
          for (Iterator i = events.iterator(); i.hasNext();) {
              AsyncEvent event = (AsyncEvent);
              String originalRegionName = event.getRegion().getName();
              //For illustration purpose, use the event to update the duplicate of above region.
              final Region duplicateRegion = CacheHelper.getCache().getRegion(originalRegionName + "_DUP");
              final Object key = event.getKey();
              final Object value = event.getDeserializedValue();
              final Operation op = event.getOperation();
              if (op.isCreate()) {
                  duplicateRegion.create(key, value);
              } else if (op.isUpdate()) {
                  duplicateRegion.put(key, value);
              } else if (op.isDestroy()) {


Method Summary
 boolean processEvents(List<AsyncEvent> events)
          Process the list of AsyncEvents.
Methods inherited from interface com.gemstone.gemfire.cache.CacheCallback

Method Detail


boolean processEvents(List<AsyncEvent> events)
Process the list of AsyncEvents. This method will asynchronously be called when events are queued to be processed. The size of the list will be up to batch size events where batch size is defined in the AsyncEventQueueFactory.

events - The list of AsyncEvent to process
boolean True represents whether the events were successfully processed, false otherwise.

GemFire 7.0

Copyright © 1997-2012 VMware, Inc. All rights reserved.