Class EventStream

java.lang.Object
org.apache.pekko.event.EventStream
All Implemented Interfaces:
ActorEventBus, EventBus, LoggingBus, SubchannelClassification

public class EventStream extends Object implements LoggingBus, SubchannelClassification
An Apache Pekko EventStream is a pub-sub stream of events both system and user generated, where subscribers are ActorRefs and the channels are Classes and Events are any java.lang.Object. EventStreams employ SubchannelClassification, which means that if you listen to a Class, you'll receive any message that is of that type or a subtype.

The debug flag in the constructor toggles if operations on this EventStream should also be published as Debug-Events

  • Constructor Details

    • EventStream

      public EventStream(ActorSystem sys, boolean debug)
    • EventStream

      public EventStream(ActorSystem sys)
  • Method Details

    • classify

      protected Class<?> classify(Object event)
    • publish

      protected void publish(Object event, ActorRef subscriber)
    • startUnsubscriber

      public void startUnsubscriber()
      ''Must'' be called after actor system is "ready". Starts system actor that takes care of unsubscribing subscribers that have terminated.
    • subclassification

      protected Subclassification<Class<?>> subclassification()
      Description copied from interface: SubchannelClassification
      The logic to form sub-class hierarchy
      Specified by:
      subclassification in interface SubchannelClassification
    • subscribe

      public boolean subscribe(ActorRef subscriber, Class<?> channel)
    • unsubscribe

      public boolean unsubscribe(ActorRef subscriber, Class<?> channel)
    • unsubscribe

      public void unsubscribe(ActorRef subscriber)