Module org.evrete.core
Package org.evrete.api.events
Interface Events.Publisher<E extends Events.Event>
- Type Parameters:
E- the type of event.
- All Known Implementing Classes:
BroadcastingPublisher
- Enclosing class:
- Events
public static interface Events.Publisher<E extends Events.Event>
A Publisher provides a mechanism to subscribe consumers to it.
-
Method Summary
Modifier and TypeMethodDescriptionSubscribes a consumer to this publisher.default Events.Subscriptiondefault voidsubscribe(Events.Subscriptions sink, boolean async, Consumer<E> listener) Subscribes a consumer to this publisher and stores the subscription in the provided cancellable collection.default voidsubscribe(Events.Subscriptions sink, Consumer<E> listener) default Events.SubscriptionsubscribeAsync(Consumer<E> listener) default voidsubscribeAsync(Events.Subscriptions sink, Consumer<E> listener)
-
Method Details
-
subscribe
Subscribes a consumer to this publisher.- Parameters:
async- iftrue, the listener will be invoked asynchronously using theAbstractKnowledgeService.getExecutor(); iffalse, it will be invoked synchronouslylistener- the consumer that will receive the published items.- Returns:
- the result of the subscribe operation.
-
subscribe
Subscribes a consumer to this publisher and stores the subscription in the provided cancellable collection.- Parameters:
async- iftrue, the listener will be invoked asynchronously using theAbstractKnowledgeService.getExecutor(); iffalse, it will be invoked synchronouslylistener- the consumer that will receive the published items.
-
subscribe
-
subscribe
-
subscribeAsync
-
subscribeAsync
-