Packages

c

akka.persistence.typed.javadsl

EventSourcedBehavior

abstract class EventSourcedBehavior[Command, Event, State >: Null] extends DeferredBehavior[Command]

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. EventSourcedBehavior
  2. DeferredBehavior
  3. Behavior
  4. AnyRef
  5. Any
Implicitly
  1. by BehaviorDecorators
  2. by BehaviorDecorators
  3. by any2stringadd
  4. by StringFormat
  5. by Ensuring
  6. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new EventSourcedBehavior(persistenceId: PersistenceId, onPersistFailure: BackoffSupervisorStrategy)
  2. new EventSourcedBehavior(persistenceId: PersistenceId)

Concrete Value Members

  1. def apply(context: TypedActorContext[Command]): Behavior[Command]

    INTERNAL API: DeferredBehavior init

    INTERNAL API: DeferredBehavior init

    Definition Classes
    EventSourcedBehavior → DeferredBehavior
    Annotations
    @InternalApi()
  2. def eventAdapter(): EventAdapter[Event, _]
  3. final def narrow[U <: Command]: Behavior[U]

    Narrow the type of this Behavior, which is always a safe operation.

    Narrow the type of this Behavior, which is always a safe operation. This method is necessary to implement the contravariant nature of Behavior (which cannot be expressed directly due to type inference problems).

    Definition Classes
    Behavior
  4. def onRecoveryCompleted(state: State): Unit

    The callback function is called to notify the actor that the recovery process is finished.

  5. def onRecoveryFailure(failure: Throwable): Unit

    The callback function is called to notify the actor that the recovery process has failed

  6. def onSnapshot(meta: SnapshotMetadata, result: Optional[Throwable]): Unit

    Override to get notified when a snapshot is finished.

    Override to get notified when a snapshot is finished.

    result

    None if successful otherwise contains the exception thrown when snapshotting

  7. final def orElse(that: Behavior[Command]): Behavior[Command]

    Composes this Behavior with a fallback Behavior which is used when this Behavior doesn't handle the message or signal, i.e. when unhandled is returned.

    Composes this Behavior with a fallback Behavior which is used when this Behavior doesn't handle the message or signal, i.e. when unhandled is returned.

    that

    the fallback Behavior

    Definition Classes
    Behavior
  8. val persistenceId: PersistenceId
  9. def shouldSnapshot(state: State, event: Event, sequenceNr: Long): Boolean

    Initiates a snapshot if the given function returns true.

    Initiates a snapshot if the given function returns true. When persisting multiple events at once the snapshot is triggered after all the events have been persisted.

    receives the State, Event and the sequenceNr used for the Event

    returns

    true if snapshot should be saved for the given event

    See also

    EventSourcedBehavior#snapshotEvery

  10. def snapshotEvery(): Long

    Override and define that snapshot should be saved every N events.

    Override and define that snapshot should be saved every N events.

    If this is overridden shouldSnapshot is not used.

    returns

    number of events between snapshots, should be greater than 0

    See also

    EventSourcedBehavior#shouldSnapshot

  11. def tagsFor(event: Event): Set[String]

    The tagger function should give event tags, which will be used in persistence query

Shadowed Implicit Value Members

  1. val behavior: Behavior[Command]
    Implicit
    This member is added by an implicit conversion from EventSourcedBehavior[Command, Event, State] to BehaviorDecorators[Command] performed by method BehaviorDecorators in akka.actor.typed.Behavior.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (eventSourcedBehavior: BehaviorDecorators[Command]).behavior
    Definition Classes
    BehaviorDecorators
  2. val behavior: Behavior[Command]
    Implicit
    This member is added by an implicit conversion from EventSourcedBehavior[Command, Event, State] to BehaviorDecorators[Command] performed by method BehaviorDecorators in akka.actor.typed.Behavior.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (eventSourcedBehavior: BehaviorDecorators[Command]).behavior
    Definition Classes
    BehaviorDecorators
  3. def widen[U](matcher: PartialFunction[U, Command]): Behavior[U]

    Widen the wrapped Behavior by placing a funnel in front of it: the supplied PartialFunction decides which message to pull in (those that it is defined at) and may transform the incoming message to place them into the wrapped Behavior’s type hierarchy.

    Widen the wrapped Behavior by placing a funnel in front of it: the supplied PartialFunction decides which message to pull in (those that it is defined at) and may transform the incoming message to place them into the wrapped Behavior’s type hierarchy. Signals are not transformed.

    Example:

    receive[String] { (ctx, msg) => println(msg); same }.widen[Number] {
      case b: BigDecimal => s"BigDecimal($b)"
      case i: BigInteger => s"BigInteger($i)"
      // all other kinds of Number will be `unhandled`
    }

    Scheduled messages via akka.actor.typed.scaladsl.TimerScheduler can currently not be used together with widen, see issue #25318.

    Implicit
    This member is added by an implicit conversion from EventSourcedBehavior[Command, Event, State] to BehaviorDecorators[Command] performed by method BehaviorDecorators in akka.actor.typed.Behavior.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (eventSourcedBehavior: BehaviorDecorators[Command]).widen(matcher)
    Definition Classes
    BehaviorDecorators
  4. def widen[U](matcher: PartialFunction[U, Command]): Behavior[U]

    Widen the wrapped Behavior by placing a funnel in front of it: the supplied PartialFunction decides which message to pull in (those that it is defined at) and may transform the incoming message to place them into the wrapped Behavior’s type hierarchy.

    Widen the wrapped Behavior by placing a funnel in front of it: the supplied PartialFunction decides which message to pull in (those that it is defined at) and may transform the incoming message to place them into the wrapped Behavior’s type hierarchy. Signals are not transformed.

    Example:

    receive[String] { (ctx, msg) => println(msg); same }.widen[Number] {
      case b: BigDecimal => s"BigDecimal($b)"
      case i: BigInteger => s"BigInteger($i)"
      // all other kinds of Number will be `unhandled`
    }

    Scheduled messages via akka.actor.typed.scaladsl.TimerScheduler can currently not be used together with widen, see issue #25318.

    Implicit
    This member is added by an implicit conversion from EventSourcedBehavior[Command, Event, State] to BehaviorDecorators[Command] performed by method BehaviorDecorators in akka.actor.typed.Behavior.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (eventSourcedBehavior: BehaviorDecorators[Command]).widen(matcher)
    Definition Classes
    BehaviorDecorators