org.eligosource.eventsourced.core

Emitter

trait Emitter extends Receiver

Stackable modification for actors to provide convenient access to registered org.eligosource.eventsourced.core.Channels and to emit event org.eligosource.eventsourced.core.Messages to these channels. Registered channels are those that have been created with the EventsourcingExtension.channelOf method.

val myEmitter = system.actorOf(Props(new MyEmitter with Emitter))

myEmitter ! Message("foo event")

class MyEmitter extends Actor { this: Emitter =>
  def receive = {
    case "foo event" => {
      // emit event messages to named channels (where emitted
      // event messages are derived from the current message)

      // emit event to channelA setting this actor as sender
      emitter("channelA") sendEvent "bar event"

      // emit event to channelB preserving the original sender
      emitter("channelB") forwardEvent "baz event"
      // ...
    }
  }
}

Applications may also use org.eligosource.eventsourced.core.Channel actor references directly to emit event messages to destinations (using the !, ? or forward methods on ActorRef).

The Emitter trait can also be used in combination with other stackable traits of the library (such as org.eligosource.eventsourced.core.Confirm or org.eligosource.eventsourced.core.Eventsourced), for example:

val myEmitter = system.actorOf(Props(new MyEmitter with Emitter with Confirm with Eventsourced { val id = ... } ))

class MyEmitter extends Actor { this: Emitter =>
  def receive = {
    // ...
  }
}
See also

org.eligosource.eventsourced.core.MessageEmitter org.eligosource.eventsourced.core.MessageEmitterFactory

Linear Supertypes
Receiver, Behavior, Actor, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Emitter
  2. Receiver
  3. Behavior
  4. Actor
  5. AnyRef
  6. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. type Receive = PartialFunction[Any, Unit]

    Definition Classes
    Actor

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def become(behavior: Procedure[Any], discardOld: Boolean): Unit

    Java API.

    Java API.

    Puts behavior on the hotswap stack. This will preserve the behavior of this stackable trait. Actors that additionally want to replace the behavior of this stackable trait should call getContext().become(...).

    behavior

    new behavior

    discardOld

    if true, unbecome() will be called prior to pushing behavior.

    Definition Classes
    Behavior
  8. def become(behavior: Procedure[Any]): Unit

    Java API.

    Java API.

    Puts behavior on the hotswap stack. This will preserve the behavior of this stackable trait. Actors that additionally want to replace the behavior of this stackable trait should call getContext().become(...). The existing (old) behavior will be discarded.

    behavior

    new behavior

    Definition Classes
    Behavior
  9. def become(behavior: akka.actor.Actor.Receive, discardOld: Boolean = true): Unit

    Puts behavior on the hotswap stack.

    Puts behavior on the hotswap stack. This will preserve the behavior of this stackable trait. Actors that additionally want to replace the behavior of this stackable trait should call context.become(...).

    behavior

    new behavior

    discardOld

    if true, unbecome() will be called prior to pushing behavior.

    Definition Classes
    Behavior
  10. def channels: Map[Int, ActorRef]

    Returns a map of registered org.eligosource.eventsourced.core.Channels.

    Returns a map of registered org.eligosource.eventsourced.core.Channels. Mapping key is the channel id.

  11. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  12. def confirm(pos: Boolean = true): Unit

    Positively or negatively confirms the receipt of the current event message.

    Positively or negatively confirms the receipt of the current event message.

    pos

    true for a positive receipt confirmation, false for a negative one.

    Definition Classes
    Receiver
    Exceptions thrown
    IllegalStateException

    if the the last message received by this receiver is not of type org.eligosource.eventsourced.core.Message

  13. implicit val context: ActorContext

    Definition Classes
    Actor
  14. def emitter(channelName: String): MessageEmitter

    Returns a message emitter that captures the current event message and a channel that has been registered under channelName.

    Returns a message emitter that captures the current event message and a channel that has been registered under channelName. If no channel exists for channelName it will be context.system.deadLetters. Applications can run the returned emitter from within any thread for sending output messages (which will be derived from the captured event message).

  15. def emitter(channelId: Int): MessageEmitter

    Returns a message emitter that captures the current event message and a channel that has been registered under channelId.

    Returns a message emitter that captures the current event message and a channel that has been registered under channelId. If no channel exists for channelId it will be context.system.deadLetters. Applications can run the returned emitter from within any thread for sending output messages (which will be derived from the captured event message).

  16. def emitter: MessageEmitterFactory

    Returns a message emitter factory that captures the current event message and the map of registered channels.

    Returns a message emitter factory that captures the current event message and the map of registered channels. Applications can run the returned emitter factory from within any thread.

  17. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  18. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  19. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  20. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  21. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  22. final def invoke(msg: Any): Unit

    Definition Classes
    Behavior
  23. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  24. def message: Message

    Current event message.

    Current event message.

    Definition Classes
    Receiver
    Exceptions thrown
    IllegalStateException

    if the the last message received by this receiver is not of type org.eligosource.eventsourced.core.Message

    See also

    messageOption

  25. def messageOption: Option[Message]

    Current event message option.

    Current event message option. None if the last message received by this receiver is not of type org.eligosource.eventsourced.core.Message.

    Definition Classes
    Receiver
  26. def namedChannels: Map[String, ActorRef]

    Returns a map of registered named org.eligosource.eventsourced.core.Channels.

    Returns a map of registered named org.eligosource.eventsourced.core.Channels. Mapping key is the channel name.

  27. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  28. final def notify(): Unit

    Definition Classes
    AnyRef
  29. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  30. def postRestart(reason: Throwable): Unit

    Definition Classes
    Actor
    Annotations
    @throws( classOf[java.lang.Exception] )
  31. def postStop(): Unit

    Definition Classes
    Actor
    Annotations
    @throws( classOf[java.lang.Exception] )
  32. def preRestart(reason: Throwable, message: Option[Any]): Unit

    Definition Classes
    Actor
    Annotations
    @throws( classOf[java.lang.Exception] )
  33. def preStart(): Unit

    Definition Classes
    Actor
    Annotations
    @throws( classOf[java.lang.Exception] )
  34. def receive: PartialFunction[Any, Unit]

    Definition Classes
    EmitterReceiverBehavior → Actor
  35. implicit final val self: ActorRef

    Definition Classes
    Actor
  36. final def sender: ActorRef

    Definition Classes
    Actor
  37. def sequenceNr: Long

    Sequence number of current event message

    Sequence number of current event message

    Definition Classes
    Receiver
    Exceptions thrown
    IllegalStateException

    if the the last message received by this receiver is not of type org.eligosource.eventsourced.core.Message

  38. def supervisorStrategy: SupervisorStrategy

    Definition Classes
    Actor
  39. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  40. def toString(): String

    Definition Classes
    AnyRef → Any
  41. def unbecome(): Unit

    Reverts the behavior to the previous one on the hotswap stack.

    Reverts the behavior to the previous one on the hotswap stack. This will preserve the behavior of this stackable trait.

    Definition Classes
    Behavior
  42. def unhandled(message: Any): Unit

    Definition Classes
    Actor
  43. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  44. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  45. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Receiver

Inherited from Behavior

Inherited from Actor

Inherited from AnyRef

Inherited from Any

Ungrouped