Package akka.event

Class EventStream

  • All Implemented Interfaces:
    ActorEventBus, EventBus, LoggingBus, SubchannelClassification

    public class EventStream
    extends java.lang.Object
    implements LoggingBus, SubchannelClassification
    An Akka 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 Detail

      • EventStream

        public EventStream​(ActorSystem sys,
                           boolean debug)
    • Method Detail

      • classify

        protected java.lang.Class<?> classify​(java.lang.Object event)
      • publish

        protected void publish​(java.lang.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.
      • subscribe

        public boolean subscribe​(ActorRef subscriber,
                                 java.lang.Class<?> channel)
        Subscribe an actor to listen for types and subtypes by passing Class to channel argument. The same actor can create multiple subscriptions for different Class.
      • unsubscribe

        public boolean unsubscribe​(ActorRef subscriber,
                                   java.lang.Class<?> channel)
        Unsubscribe specific types subscriptions created by this actor from the event stream.
      • unsubscribe

        public void unsubscribe​(ActorRef subscriber)
        Unsubscribe all subscriptions created by this actor from the event stream.