org.eligosource.eventsourced.core

Eventsourced

trait Eventsourced extends Behavior

Stackable modification for making an actor persistent via event-sourcing (or command-sourcing). It writes any input org.eligosource.eventsourced.core.Message to a journal. Input messages of any other type are not journaled. Example:

val system: ActorSystem = ...
val journal: ActorRef = ...
val extension = EventsourcingExtension(system, journal)

class MyActor extends Actor {
  def receive = {
    case msg: Message => // journaled event message
    case msg          => // non-journaled message
  }
}

// create and register and event-sourced actor (processor)
val myActor = extension.processorOf(Props(new MyActor with Eventsourced { val id = 1 } ))

// replay journaled messages from previous application runs
extension.recover()

myActor ! Message("foo event") // message will be journaled
myActor ! "whatever"           // message will not be journaled

If the Eventsourced trait is used in combination with org.eligosource.eventsourced.core.Receiver or org.eligosource.eventsourced.core.Emitter, Eventsourced must be the last modification:

new Actor with Receiver with Eventsourced { ... }  // ok
new Actor with Emitter with Eventsourced { ... }   // ok
new Actor with Eventsourced with Receiver { ... }  // won't work
new Actor with Eventsourced with Emitter { ... }   // won't work

The Eventsourced trait can additionally be combined with the stackable org.eligosource.eventsourced.core.Confirm trait.

See also

org.eligosource.eventsourced.core.EventsourcingExtension

Linear Supertypes
Behavior, Actor, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Eventsourced
  2. Behavior
  3. Actor
  4. AnyRef
  5. 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

Abstract Value Members

  1. abstract def id: Int

    Processor id.

Concrete 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 clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. implicit val context: ActorContext

    Definition Classes
    Actor
  12. final def eq(arg0: AnyRef): Boolean

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

    Definition Classes
    AnyRef → Any
  14. val extension: EventsourcingExtension

    Attributes
    protected
  15. def finalize(): Unit

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

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

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

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

    Definition Classes
    Any
  20. val journal: ActorRef

    Attributes
    protected
  21. final def ne(arg0: AnyRef): Boolean

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

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

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

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

    Calls super.postStop and then de-registers this processor from org.eligosource.eventsourced.core.EventsourcingExtension.

    Calls super.postStop and then de-registers this processor from org.eligosource.eventsourced.core.EventsourcingExtension.

    Definition Classes
    Eventsourced → Actor
  26. def preRestart(reason: Throwable, message: Option[Any]): Unit

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

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

    Definition Classes
    EventsourcedBehavior → Actor
  29. implicit final val self: ActorRef

    Definition Classes
    Actor
  30. final def sender: ActorRef

    Definition Classes
    Actor
  31. def supervisorStrategy: SupervisorStrategy

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

    Definition Classes
    AnyRef
  33. def toString(): String

    Definition Classes
    AnyRef → Any
  34. 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
  35. def unhandled(message: Any): Unit

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

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Behavior

Inherited from Actor

Inherited from AnyRef

Inherited from Any

Ungrouped