InterestRegistrationListener (Apache Geode 1.15.4)

org.apache.geode.cache

## Interface InterestRegistrationListener

- All Superinterfaces:
    CacheCallback, Declarable

      public interface InterestRegistrationListener
      extends CacheCallback

  Interface `InterestRegisterationListener` provides the ability for applications to be notified of interest registration and unregistration events. Instances must be implemented by applications and registered in `CacheServer` VMs using the `registerInterestRegistrationListener` API. The methods on an `InterestRegisterationListener` are invoked synchronously with the interest event in any `CacheServer` VM hosting the requesting client's subscriptions.

  Shown below is an example implementation.

       import org.apache.geode.cache.InterestRegistrationEvent;
       import org.apache.geode.cache.InterestRegistrationListener;

       public class TestInterestRegistrationListener implements InterestRegistrationListener {

         public void afterRegisterInterest(InterestRegistrationEvent event) {
           System.out.println(
               "afterRegisterInterest: " + event.getRegionName() + " -> " + event.getKeysOfInterest());
         }

         public void afterUnregisterInterest(InterestRegistrationEvent event) {
           System.out.println("afterUnregisterInterest: " + event.getRegionName() + " -> "
               + event.getKeysOfInterest());
         }

         public void close() {}
       }

  Shown below is an example registration.

      private void registerInterestRegistrationListener() {
        Cache cache = ...;
        CacheServer cs = cache.getCacheServers().iterator().next();
        InterestRegistrationListener listener = new TestInterestRegistrationListener();
        cs.registerInterestRegistrationListener(listener);
      }

  Since:
    GemFire 6.0
  See Also:
    `registerInterestRegistrationListener`, `unregisterInterestRegistrationListener`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterRegisterInterest(InterestRegistrationEvent event)` Handles an after register interest event.
    `void` | `afterUnregisterInterest(InterestRegistrationEvent event)` Handles an after unregister interest event.

    - ### Methods inherited from interface org.apache.geode.cache.CacheCallback

      `close`

    - ### Methods inherited from interface org.apache.geode.cache.Declarable

      `init, initialize`

- - ### Method Detail

    - #### afterRegisterInterest

          void afterRegisterInterest(InterestRegistrationEvent event)

      Handles an after register interest event.
      Parameters:
        `event` - the InterestRegistrationEvent

    - #### afterUnregisterInterest

          void afterUnregisterInterest(InterestRegistrationEvent event)

      Handles an after unregister interest event.
      Parameters:
        `event` - the InterestRegistrationEvent