public interface InterestRegistrationListener extends CacheCallback
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); }
registerInterestRegistrationListener
,
unregisterInterestRegistrationListener
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.
|
close
void afterRegisterInterest(InterestRegistrationEvent event)
event
- the InterestRegistrationEventvoid afterUnregisterInterest(InterestRegistrationEvent event)
event
- the InterestRegistrationEvent