Package org.projectnessie.events.service
Class EventService
java.lang.Object
org.projectnessie.events.service.EventService
- All Implemented Interfaces:
AutoCloseable
Base class for event services.
This class takes care of starting and stopping the subscribers, and provides helper methods for handling incoming results from the version store, and for firing events.
This class is meant to be used as a singleton. It provides all the required functionality to process and deliver events. Subclasses may override some of the protected methods to add support for tracing, or to implement more sophisticated delivery logic.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final EventConfigstatic final Stringprotected final EventFactoryprotected final EventSubscribersstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionEventService(EventConfig config, EventFactory factory, EventSubscribers subscribers) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the event service by deactivating the subscribers.protected voiddeliverEvent(org.projectnessie.events.api.Event event, org.projectnessie.events.spi.EventSubscriber subscriber, org.projectnessie.events.spi.EventSubscription subscription) protected voidfireEvent(org.projectnessie.events.api.Event event) Forwards the event to all subscribers.voidInvoked when a result is received from the version store byResultCollector, then forwarded to this service for delivery.voidstart()Starts event delivery by activating the subscribers.
-
Field Details
-
SUBSCRIPTION_ID_MDC_KEY
- See Also:
-
EVENT_ID_MDC_KEY
- See Also:
-
config
-
factory
-
subscribers
-
-
Constructor Details
-
EventService
-
-
Method Details
-
start
public void start()Starts event delivery by activating the subscribers. -
close
public void close()Closes the event service by deactivating the subscribers.- Specified by:
closein interfaceAutoCloseable
-
onVersionStoreEvent
Invoked when a result is received from the version store byResultCollector, then forwarded to this service for delivery. -
fireEvent
protected void fireEvent(org.projectnessie.events.api.Event event) Forwards the event to all subscribers. -
deliverEvent
protected void deliverEvent(org.projectnessie.events.api.Event event, org.projectnessie.events.spi.EventSubscriber subscriber, org.projectnessie.events.spi.EventSubscription subscription)
-