Class EventSourcedBehavior$
java.lang.Object
org.apache.pekko.persistence.typed.scaladsl.EventSourcedBehavior$
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final EventSourcedBehavior$Static reference to the singleton instance of this Scala object. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<Command,Event, State>
EventSourcedBehavior<Command,Event, State> apply(PersistenceId persistenceId, State emptyState, scala.Function2<State, Command, Effect<Event, State>> commandHandler, scala.Function2<State, Event, State> eventHandler) Create aBehaviorfor a persistent actor.longlastSequenceNumber(ActorContext<?> context) The last sequence number that was persisted, can only be called from inside the handlers of anEventSourcedBehavior<Command,Event, State>
EventSourcedBehavior<Command,Event, State> withEnforcedReplies(PersistenceId persistenceId, State emptyState, scala.Function2<State, Command, ReplyEffect<Event, State>> commandHandler, scala.Function2<State, Event, State> eventHandler) Create aBehaviorfor a persistent actor that is enforcing that replies to commands are not forgotten.
-
Field Details
-
MODULE$
Static reference to the singleton instance of this Scala object.
-
-
Constructor Details
-
EventSourcedBehavior$
public EventSourcedBehavior$()
-
-
Method Details
-
apply
public <Command,Event, EventSourcedBehavior<Command,State> Event, applyState> (PersistenceId persistenceId, State emptyState, scala.Function2<State, Command, Effect<Event, State>> commandHandler, scala.Function2<State, Event, State> eventHandler) Create aBehaviorfor a persistent actor.- Parameters:
persistenceId- stable unique identifier for the event sourced behavioremptyState- the initial state for the entity before any events have been processedcommandHandler- map commands to effects e.g. persisting events, replying to commandseventHandler- compute the new state given the current state when an event has been persisted
-
withEnforcedReplies
public <Command,Event, EventSourcedBehavior<Command,State> Event, withEnforcedRepliesState> (PersistenceId persistenceId, State emptyState, scala.Function2<State, Command, ReplyEffect<Event, State>> commandHandler, scala.Function2<State, Event, State> eventHandler) Create aBehaviorfor a persistent actor that is enforcing that replies to commands are not forgotten. Then there will be compilation errors if the returned effect isn't aReplyEffect, which can be created withEffect.reply,Effect.noReply,EffectBuilder.thenReply, orEffectBuilder.thenNoReply. -
lastSequenceNumber
The last sequence number that was persisted, can only be called from inside the handlers of anEventSourcedBehavior
-