Class ManagedActorEventBus<E>

  • All Implemented Interfaces:
    EventBus<E,​ActorRef,​ActorRef>

    public abstract class ManagedActorEventBus<E>
    extends java.lang.Object
    implements EventBus<E,​ActorRef,​ActorRef>
    This is a size hint for the number of Classifiers you expect to have (use powers of 2)
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract ActorRef classify​(E event)
      Returns the Classifier associated with the given Event
      protected abstract int mapSize()
      This is a size hint for the number of Classifiers you expect to have (use powers of 2)
      void publish​(E event)
      Publishes the specified Event to this bus
      boolean subscribe​(ActorRef subscriber, ActorRef to)
      Attempts to register the subscriber to the specified Classifier
      void unsubscribe​(ActorRef subscriber)
      Attempts to deregister the subscriber from all Classifiers it may be subscribed to
      boolean unsubscribe​(ActorRef subscriber, ActorRef from)
      Attempts to deregister the subscriber from the specified Classifier
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ManagedActorEventBus

        public ManagedActorEventBus​(ActorSystem system)
    • Method Detail

      • classify

        protected abstract ActorRef classify​(E event)
        Returns the Classifier associated with the given Event
        Parameters:
        event - (undocumented)
        Returns:
        (undocumented)
      • mapSize

        protected abstract int mapSize()
        This is a size hint for the number of Classifiers you expect to have (use powers of 2)
        Returns:
        (undocumented)
      • publish

        public void publish​(E event)
        Description copied from interface: EventBus
        Publishes the specified Event to this bus
        Specified by:
        publish in interface EventBus<E,​ActorRef,​ActorRef>
        Parameters:
        event - (undocumented)
      • subscribe

        public boolean subscribe​(ActorRef subscriber,
                                 ActorRef to)
        Description copied from interface: EventBus
        Attempts to register the subscriber to the specified Classifier
        Specified by:
        subscribe in interface EventBus<E,​ActorRef,​ActorRef>
        Parameters:
        subscriber - (undocumented)
        to - (undocumented)
        Returns:
        true if successful and false if not (because it was already subscribed to that Classifier, or otherwise)
      • unsubscribe

        public boolean unsubscribe​(ActorRef subscriber,
                                   ActorRef from)
        Description copied from interface: EventBus
        Attempts to deregister the subscriber from the specified Classifier
        Specified by:
        unsubscribe in interface EventBus<E,​ActorRef,​ActorRef>
        Parameters:
        subscriber - (undocumented)
        from - (undocumented)
        Returns:
        true if successful and false if not (because it wasn't subscribed to that Classifier, or otherwise)
      • unsubscribe

        public void unsubscribe​(ActorRef subscriber)
        Description copied from interface: EventBus
        Attempts to deregister the subscriber from all Classifiers it may be subscribed to
        Specified by:
        unsubscribe in interface EventBus<E,​ActorRef,​ActorRef>
        Parameters:
        subscriber - (undocumented)