Class BroadcastingPublisher<E extends Events.Event>

java.lang.Object
org.evrete.util.BroadcastingPublisher<E>
Type Parameters:
E - the type of event that this publisher will broadcast
All Implemented Interfaces:
Events.Publisher<E>

public class BroadcastingPublisher<E extends Events.Event> extends Object implements Events.Publisher<E>
An implementation of the Events.Publisher interface that can broadcast events. When constructed using the BroadcastingPublisher(BroadcastingPublisher) constructor, this implementation will publish events to both its own subscriptions and those of its parent.
  • Constructor Details

    • BroadcastingPublisher

      public BroadcastingPublisher(Executor executor)
    • BroadcastingPublisher

      public BroadcastingPublisher(BroadcastingPublisher<E> other)
  • Method Details

    • totalLocalSubscriptions

      public int totalLocalSubscriptions()
    • subscribe

      public Events.Subscription subscribe(boolean async, Consumer<E> listener)
      Description copied from interface: Events.Publisher
      Subscribes a consumer to this publisher.
      Specified by:
      subscribe in interface Events.Publisher<E extends Events.Event>
      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.
    • broadcast

      public void broadcast(E event)