0

I've been playing around with akka persistence, and saw more than one example about persisting events for primitive types like string, and found no implementation for custom objects, I went through these slides Event sourcing in practice, and realized that this can be accomplished by replaying event stream on a blank object.

So, how this can be accomplished using Akka.Persistence?

Stefano Bonetti
  • 8,973
  • 1
  • 25
  • 44
Geiziry
  • 23
  • 5
  • If you're talking about having seen a "string" example like this... https://petabridge.com/blog/intro-to-persistent-actors/ ...then if your question was about "string" versus "custom" then maybe the mental leap you need to make is that _string_ is just the type of the message. Pretty sure it'll work finely if you just replace it with a (serializable) custom message type. If your question was broader, then that link hopefully contains the answers you need too. – mwardm Mar 12 '17 at 23:11
  • More info here also: http://getakka.net/docs/persistence/persistent-actors – mwardm Mar 12 '17 at 23:16
  • @mwardm no it doesn't work. what I understood from the slides linked in my question is that in Event Sourcing, to recover an object you'll have a blank instance from that object and then start to replay stream of events (messages) on that object, so it's not the same as string, which will be recovered from just one event. – Geiziry Mar 13 '17 at 05:13
  • I think your Recover handler should get called multiple times, being passed each saved event in turn from oldest to newest? – mwardm Mar 13 '17 at 09:11

0 Answers0