This example illustrates event sourcing with Apache Pekko Persistence.
Study the source code of the ShoppingCart.scala. A few things to note:
EventSourcedBehaviorCommand, Event and StatereplyTo: ActorRef to send a confirmation when the event has been successfully persistedState is only updated in the event handlerwithRetention to enable snapshottingonPersistFailure defines restarts with backoff in case of failuresTests are defined in ShoppingCartTest.java. To run the tests, enter:
mvn test
The ShoppingCart application is expanded further in the pekko-sample-cqrs-java sample. In that sample the events are tagged to be consumed by even processors to build other representations from the events, or publish the events to other services.