Skip to content

Commit

Permalink
avoiding fixed persistenceId on example (#30203)
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscolopezsancho committed May 3, 2021
1 parent 5de4942 commit 4f5e013
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Expand Up @@ -46,8 +46,8 @@ interface Event {}

public static class State {}

public static Behavior<Command> create() {
return new MyPersistentBehavior(PersistenceId.ofUniqueId("pid"));
public static Behavior<Command> create(PersistenceId persistenceId) {
return new MyPersistentBehavior(persistenceId);
}

private MyPersistentBehavior(PersistenceId persistenceId) {
Expand Down
Expand Up @@ -108,10 +108,10 @@ object BasicPersistentBehaviorCompileOnly {
import MyPersistentBehavior._

object RecoveryBehavior {
def apply(): Behavior[Command] =
def apply(persistenceId: PersistenceId): Behavior[Command] =
//#recovery
EventSourcedBehavior[Command, Event, State](
persistenceId = PersistenceId.ofUniqueId("abc"),
persistenceId = persistenceId,
emptyState = State(),
commandHandler = (state, cmd) => throw new NotImplementedError("TODO: process the command & return an Effect"),
eventHandler = (state, evt) => throw new NotImplementedError("TODO: process the event return the next state"))
Expand Down

0 comments on commit 4f5e013

Please sign in to comment.