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)
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(...)
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)
>
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
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
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.
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