com.rbmhtechnology.eventuate

EventsourcedActor

trait EventsourcedActor extends EventsourcedView

An EventsourcedActor is an EventsourcedView that can also produce (= emit) new events to its event log. New events can be produced with methods persist, persistN and persistWithLocalTime. They must only be used within the onCommand command handler. The command handler may only read internal state but must not modify it. Internal state may only be modified within onEvent.

An EventsourcedActor maintains a VectorClock used to time-stamp the events it emits to the event log. Events that are handled by its event handler update the vector clock. Events that are pushed from the eventLog actor but not handled by onEvent do not update the vector clock.

See also

EventsourcedView

Linear Supertypes
EventsourcedView, ActorLogging, InternalStash, StashFactory, Stash, RequiresMessageQueue[DequeBasedMessageQueueSemantics], UnrestrictedStash, StashSupport, ConditionalCommands, Actor, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. EventsourcedActor
  2. EventsourcedView
  3. ActorLogging
  4. InternalStash
  5. StashFactory
  6. Stash
  7. RequiresMessageQueue
  8. UnrestrictedStash
  9. StashSupport
  10. ConditionalCommands
  11. Actor
  12. AnyRef
  13. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. type Handler[A] = (Try[A]) ⇒ Unit

    Definition Classes
    EventsourcedView
  2. type Receive = PartialFunction[Any, Unit]

    Definition Classes
    Actor

Abstract Value Members

  1. abstract def eventLog: ActorRef

    Event log actor.

    Event log actor.

    Definition Classes
    EventsourcedView
  2. abstract def id: String

    Global unique actor id.

    Global unique actor id.

    Definition Classes
    EventsourcedView
  3. abstract def onCommand: Receive

    Command handler.

    Command handler.

    Definition Classes
    EventsourcedView
  4. abstract def onEvent: Receive

    Event handler.

    Event handler.

    Definition Classes
    EventsourcedView

Concrete Value Members

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

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

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

    Definition Classes
    AnyRef → Any
  4. def aggregateId: Option[String]

    Optional aggregate id.

    Optional aggregate id. It is used for routing DurableEvents to event-sourced destinations which can be EventsourcedViews or EventsourcedActors. By default, an event is routed to an event-sourced destination with an undefined aggregateId. If a destination's aggregateId is defined it will only receive events with a matching aggregate id in DurableEvent#destinationAggregateIds.

    Definition Classes
    EventsourcedView
  5. def aroundPostRestart(reason: Throwable): Unit

    Attributes
    protected[akka]
    Definition Classes
    Actor
  6. def aroundPostStop(): Unit

    Attributes
    protected[akka]
    Definition Classes
    Actor
  7. def aroundPreRestart(reason: Throwable, message: Option[Any]): Unit

    Attributes
    protected[akka]
    Definition Classes
    Actor
  8. def aroundPreStart(): Unit

    Attributes
    protected[akka]
    Definition Classes
    Actor
  9. def aroundReceive(receive: akka.actor.Actor.Receive, msg: Any): Unit

    Attributes
    protected[akka]
    Definition Classes
    Actor
  10. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  11. def clone(): AnyRef

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

    Definition Classes
    Actor
  13. final def delay[A](command: A)(handler: (A) ⇒ Unit): Unit

    Delays handling of command to that point in the future where all previously called persist or persistN operations completed.

    Delays handling of command to that point in the future where all previously called persist or persistN operations completed. Therefore, using this method only makes sense if stateSync is set to false. The handler is called during a separate message dispatch by this actor, hence, it is safe to access internal state within handler.

    See also

    ConditionalCommand

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

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

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

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

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

    Definition Classes
    AnyRef → Any
  19. val instanceId: Int

    Definition Classes
    EventsourcedView
  20. def internalStash(): Unit

    Internal API.

    Internal API.

    Definition Classes
    InternalStash
  21. def internalUnstash(): Unit

    Internal API.

    Internal API.

    Definition Classes
    InternalStash
  22. def internalUnstashAll(): Unit

    Internal API.

    Internal API.

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

    Definition Classes
    Any
  24. final def lastEmitterAggregateId: Option[String]

    Emitter aggregate id of the last handled event.

    Emitter aggregate id of the last handled event.

    Definition Classes
    EventsourcedView
  25. final def lastEmitterId: String

    Emitter id of the last handled event.

    Emitter id of the last handled event.

    Definition Classes
    EventsourcedView
  26. final def lastSequenceNr: Long

    Sequence number of the last handled event.

    Sequence number of the last handled event.

    Definition Classes
    EventsourcedView
  27. final def lastSystemTimestamp: Long

    Wall-clock timestamp of the last handled event.

    Wall-clock timestamp of the last handled event.

    Definition Classes
    EventsourcedView
  28. final def lastVectorTimestamp: VectorTime

    Vector timestamp of the last handled event.

    Vector timestamp of the last handled event.

    Definition Classes
    EventsourcedView
  29. def load(): Unit

    Sends a LoadSnapshot command to the event log.

    Sends a LoadSnapshot command to the event log. Can be overridden by implementations to customize snapshot loading.

    Definition Classes
    EventsourcedView
  30. def log: LoggingAdapter

    Definition Classes
    ActorLogging
  31. final def ne(arg0: AnyRef): Boolean

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

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

    Definition Classes
    AnyRef
  34. def onRecovered(): Unit

    Called after recovery successfully completed.

    Called after recovery successfully completed. Can be overridden by implementations.

    Definition Classes
    EventsourcedView
  35. def onSnapshot: Receive

    Snapshot handler.

    Snapshot handler.

    Definition Classes
    EventsourcedView
  36. final def persist[A](event: A, customDestinationAggregateIds: Set[String] = Set())(handler: Handler[A]): Unit

    Asynchronously persists the given event and calls handler with the persist result.

    Asynchronously persists the given event and calls handler with the persist result. The handler is called during a separate message dispatch by this actor, hence, it is safe to modify internal state within handler. The handler can also obtain a reference to the initial command sender via sender().

    By default, the event is routed to event-sourced destinations with an undefined aggregateId. If this actor's aggregateId is defined it is additionally routed to all actors with the same aggregateId. Further routing destinations can be defined with the customDestinationAggregateIds parameter.

  37. final def persistN[A](events: Seq[A], onLast: Handler[A] = (_: Try[A]) => (), customDestinationAggregateIds: Set[String] = Set())(handler: Handler[A]): Unit

    Asynchronously persists a sequence of events and calls handler with the persist results.

    Asynchronously persists a sequence of events and calls handler with the persist results. The handler is called for each event in the sequence during a separate message dispatch by this actor, hence, it is safe to modify internal state within handler. The handler can also obtain a reference to the initial command sender via sender(). The onLast handler is additionally called for the last event in the sequence.

    By default, the event is routed to event-sourced destinations with an undefined aggregateId. If this actor's aggregateId is defined it is additionally routed to all actors with the same aggregateId. Further routing destinations can be defined with the customDestinationAggregateIds parameter.

  38. final def persistWithLocalTime[A](f: (Long) ⇒ A, customDestinationAggregateIds: Set[String] = Set())(handler: Handler[A]): A

    Asynchronously persists the event returned by f and calls handler with the persist result.

    Asynchronously persists the event returned by f and calls handler with the persist result. The input parameter to f is the current local time which is the actor's logical time, taken from its internal vector clock, and not the current system time. The handler is called during a separate message dispatch by this actor, hence, it is safe to modify internal state within handler. The handler can also obtain a reference to the initial command sender via sender().

    By default, the event is routed to event-sourced destinations with an undefined aggregateId. If this actor's aggregateId is defined it is additionally routed to all actors with the same aggregateId. Further routing destinations can be defined with the customDestinationAggregateIds parameter.

  39. def postRestart(reason: Throwable): Unit

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

    Definition Classes
    InternalStash → UnrestrictedStash → Actor
  41. def preRestart(reason: Throwable, message: Option[Any]): Unit

    Definition Classes
    InternalStash → UnrestrictedStash → Actor
  42. def preStart(): Unit

    Initiates recovery by calling load.

    Initiates recovery by calling load.

    Definition Classes
    EventsourcedActorEventsourcedView → Actor
  43. final def receive: Receive

    Initialization behavior.

    Initialization behavior.

    Definition Classes
    EventsourcedView → Actor
  44. final def recovering: Boolean

    Returns true if this actor is currently recovering internal state by consuming replayed events from the event log.

    Returns true if this actor is currently recovering internal state by consuming replayed events from the event log. Returns false after recovery completed and the actor switches to consuming live events.

    Definition Classes
    EventsourcedView
  45. def replay(fromSequenceNr: Long = 1L): Unit

    Sends a Replay command to the event log.

    Sends a Replay command to the event log. Can be overridden by implementations to customize replay.

    Definition Classes
    EventsourcedView
  46. def save(snapshot: Any)(handler: Handler[SnapshotMetadata]): Unit

    Asynchronously saves the given snapshot and calls handler with the generated snapshot metadata.

    Asynchronously saves the given snapshot and calls handler with the generated snapshot metadata. The handler can also obtain a reference to the initial message sender via sender().

    Definition Classes
    EventsourcedView
  47. implicit final val self: ActorRef

    Definition Classes
    Actor
  48. final def sender(): ActorRef

    Definition Classes
    Actor
  49. def stash(): Unit

    Definition Classes
    StashSupport
  50. def stateSync: Boolean

    State synchronization.

    State synchronization. If set to true, commands see internal state that is consistent with the event log. This is achieved by stashing new commands if this actor is currently writing events.

    If set to false, commands see internal state that might be stale. To see state updates from any previously persisted events, applications can delay these commands. In this mode, commands are not stashed and events can be batched for write which significantly increases write throughput.

  51. def supervisorStrategy: SupervisorStrategy

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

    Definition Classes
    AnyRef
  53. def toString(): String

    Definition Classes
    AnyRef → Any
  54. def unhandled(message: Any): Unit

    Definition Classes
    Actor
  55. def unstashAll(): Unit

    Definition Classes
    StashSupport
  56. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from EventsourcedView

Inherited from ActorLogging

Inherited from InternalStash

Inherited from StashFactory

Inherited from Stash

Inherited from RequiresMessageQueue[DequeBasedMessageQueueSemantics]

Inherited from UnrestrictedStash

Inherited from StashSupport

Inherited from ConditionalCommands

Inherited from Actor

Inherited from AnyRef

Inherited from Any

Ungrouped