avoiding fixed persistenceId on example (#30203)

This commit is contained in:
franciscolopezsancho 2021-05-03 10:06:00 +01:00 committed by GitHub
parent 5de4942485
commit 4f5e01376d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -46,8 +46,8 @@ public class BasicPersistentBehaviorTest {
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) {

View file

@ -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"))