Interface PersistedHippoEventListener
-
public interface PersistedHippoEventListener
Developers can implement this interface to asynchronously receiveHippoEvents
after they occurred in the repository, across a repository cluster.Such a listener must be registered through the
PersistedHippoEventListenerRegistry
, like for example:PersistedHippoEventListenerRegistry.get().register(myPersistedHippoEventListener);
A PersistedHippoEventListener must provide a (cluster node instance unique) channel name which will be used to track which persisted events already have been delivered to the listener.
A listener will get a consistent and ordered delivery of all events within a specific
getEventCategory()
(or all if unspecified) through that channel, but such events will only be delivered once (within one cluster node) through that channel.
Therefore there should only be one listener (registered) per channel per cluster node.
If more than one listener is registered on one channel, only one will get the events delivered!A listener also has to define through
onlyNewEvents()
if it should receive persisted events even from before the first time registration on itschannel
(for as much is looked back in time, depending on the service configuration), or only events after the first time channel registration will be delivered.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
getChannelName()
String
getEventCategory()
void
onHippoEvent(HippoEvent event)
Persisted HippoEvents will be delivered through this method.boolean
onlyNewEvents()
-
-
-
Method Detail
-
getEventCategory
String getEventCategory()
- Returns:
- which category of events this listener is interested in, or
null
to indicate all events.
-
getChannelName
String getChannelName()
- Returns:
- The cluster node unique channel name to listen on for events. Note: must conform to JCR node name restrictions.
-
onlyNewEvents
boolean onlyNewEvents()
- Returns:
- if true, only events persisted after the first time registration on this
getChannelName()
will be delivered.
-
onHippoEvent
void onHippoEvent(HippoEvent event)
Persisted HippoEvents will be delivered through this method.- Parameters:
event
- the event
-
-