com.rbmhtechnology.eventuate

EventsourcedView

trait EventsourcedView extends Actor with ConditionalCommands with InternalStash with ActorLogging

An actor that derives internal state from events stored in an event log. Events are pushed from the eventLog actor to this actor and handled with the onEvent event handler. An event handler defines how internal state is updated from events.

An EventsourcedView can also store snapshots of internal state with its save method. During (re-)start the latest snapshot saved by this actor (if any) is passed as argument to the onSnapshot handler, if the handler is defined at that snapshot. If the onSnapshot handler is not defined at that snapshot or is not overridden at all, event replay starts from scratch. Newer events that are not covered by the snapshot are handled by onEvent after onSnapshot returns.

By default, an EventsourcedView does not define an aggregateId. In this case, the eventLog pushes all events to this actor. If it defines an aggregateId, the eventLog actor only pushes those events that contain that aggregateId value in their routingDestinations set.

An EventsourcedView can only consume events from its eventLog but cannot produce new events. Commands sent to an EventsourcedView during recovery are delayed until recovery completes.

See also

DurableEvent

EventsourcedActor

Linear Supertypes
ActorLogging, InternalStash, StashFactory, Stash, RequiresMessageQueue[DequeBasedMessageQueueSemantics], UnrestrictedStash, StashSupport, ConditionalCommands, Actor, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. EventsourcedView
  2. ActorLogging
  3. InternalStash
  4. StashFactory
  5. Stash
  6. RequiresMessageQueue
  7. UnrestrictedStash
  8. StashSupport
  9. ConditionalCommands
  10. Actor
  11. AnyRef
  12. 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

  2. type Receive = PartialFunction[Any, Unit]

    Definition Classes
    Actor

Abstract Value Members

  1. abstract def eventLog: ActorRef

    Event log actor.

  2. abstract def id: String

    Global unique actor id.

  3. abstract def onCommand: Receive

    Command handler.

  4. abstract def onEvent: Receive

    Event handler.

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.

  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 eq(arg0: AnyRef): Boolean

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

    Definition Classes
    AnyRef → Any
  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. val instanceId: Int

  19. def internalStash(): Unit

    Internal API.

    Internal API.

    Definition Classes
    InternalStash
  20. def internalUnstash(): Unit

    Internal API.

    Internal API.

    Definition Classes
    InternalStash
  21. def internalUnstashAll(): Unit

    Internal API.

    Internal API.

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

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

    Emitter aggregate id of the last handled event.

  24. final def lastEmitterId: String

    Emitter id of the last handled event.

  25. final def lastSequenceNr: Long

    Sequence number of the last handled event.

  26. final def lastSystemTimestamp: Long

    Wall-clock timestamp of the last handled event.

  27. final def lastVectorTimestamp: VectorTime

    Vector timestamp of the last handled event.

  28. 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.

  29. def log: LoggingAdapter

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

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

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

    Definition Classes
    AnyRef
  33. def onRecovered(): Unit

    Called after recovery successfully completed.

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

  34. def onSnapshot: Receive

    Snapshot handler.

  35. def postRestart(reason: Throwable): Unit

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

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

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

    Initiates recovery by calling load.

    Initiates recovery by calling load.

    Definition Classes
    EventsourcedView → Actor
  39. final def receive: Receive

    Initialization behavior.

    Initialization behavior.

    Definition Classes
    EventsourcedView → Actor
  40. 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.

  41. 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.

  42. 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().

  43. implicit final val self: ActorRef

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

    Definition Classes
    Actor
  45. def stash(): Unit

    Definition Classes
    StashSupport
  46. def supervisorStrategy: SupervisorStrategy

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

    Definition Classes
    AnyRef
  48. def toString(): String

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

    Definition Classes
    Actor
  50. def unstashAll(): Unit

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

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

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