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 Details

    • subscribe

      Events.Subscription subscribe(boolean async, Consumer<E> listener)
      Subscribes a consumer to this publisher.
      Parameters:
      async - if true, the listener will be invoked asynchronously using the AbstractKnowledgeService.getExecutor(); if false, it will be invoked synchronously
      listener - the consumer that will receive the published items.
      Returns:
      the result of the subscribe operation.
    • subscribe

      default void subscribe(Events.Subscriptions sink, boolean async, Consumer<E> listener)
      Subscribes a consumer to this publisher and stores the subscription in the provided cancellable collection.
      Parameters:
      async - if true, the listener will be invoked asynchronously using the AbstractKnowledgeService.getExecutor(); if false, it will be invoked synchronously
      listener - the consumer that will receive the published items.
    • subscribe

      default Events.Subscription subscribe(Consumer<E> listener)
    • subscribe

      default void subscribe(Events.Subscriptions sink, Consumer<E> listener)
    • subscribeAsync

      default Events.Subscription subscribeAsync(Consumer<E> listener)
    • subscribeAsync

      default void subscribeAsync(Events.Subscriptions sink, Consumer<E> listener)