Re: [akka-user] Event-sourcing with aka-persistence

2015-10-25 Thread Adam Dohnal
Yes, you are right that these events should be persisted atomically Dne neděle 25. října 2015 0:25:02 UTC+2 Michael Omann napsal(a): > > You can (and should) avoid this by emitting 2 events during command > handling instead if one. > > So instead of : > > AddExperience(10) -> ExperienceAdded(10)

Re: [akka-user] Event-sourcing with aka-persistence

2015-10-24 Thread Michael Omann
You can (and should) avoid this by emitting 2 events during command handling instead if one. So instead of : AddExperience(10) -> ExperienceAdded(10) -> EarnLevel(1) -> LevelEarned(1) your should derive both Events from your player's state and atomically persist 2 Events using persistAll(...)

Re: [akka-user] Event-sourcing with aka-persistence

2015-10-20 Thread Patrik Nordwall
On Tue, Oct 20, 2015 at 8:26 AM, Adam Dohnal wrote: > You understand it right. Unfortunately, your solution won't work. Suppose > player has 30/100 health (current/max) and 99/100 experience and two > messages are sent to him with this order: > > AddExperience(10) >

Re: [akka-user] Event-sourcing with aka-persistence

2015-10-20 Thread Adam Dohnal
Interesting idea, thanks. But i'm afraid I will not recognise when my event stream is finished. I will try to think about it and redesign it to get an Observable which will be finite. If I succeed at it, I can simply convert that finite Observable to collection and persist that events But

Re: [akka-user] Event-sourcing with aka-persistence

2015-10-20 Thread Adam Dohnal
You understand it right. Unfortunately, your solution won't work. Suppose player has 30/100 health (current/max) and 99/100 experience and two messages are sent to him with this order: AddExperience(10) TakeDamage(40) Correct behaviour is that first 10 xp is added to 109/100 ... level is

Re: [akka-user] Event-sourcing with aka-persistence

2015-10-19 Thread Patrik Nordwall
If I understand it correctly your question is about how to persist the LevelEarned event which comes via the asyncrounous player.observable.subscribe callback. Since this is an actor you must turn that callback into a message that is sent to self and when receiving that message you can persist it.

[akka-user] Event-sourcing with aka-persistence

2015-10-12 Thread Adam Dohnal
Hello, I am new in Akka and I am trying to develop some mini project to test some things (akka, rx, cqrs, es etc..) I think I understand the concept of cqrs/es and how it fit to akka. My problem is probably more theoretical than technical. Let's say, I have class Player, which has several