And for a more complex example, here are the events for the "Spaces" in my
app
<https://github.com/jducoeur/Querki/blob/master/querki/scalajvm/app/querki/spaces/SpaceMessagePersistence.scala>
-- basically CRUD-like operations on a roughly object-oriented database.
 (Note that these events are specifically designed to be serialized using
the Kryo library, but that's an unusual choice.)

On Sun, Mar 12, 2017 at 3:27 PM, Guido Medina <oxyg...@gmail.com> wrote:

> A concrete example:
>
> Imagining you are doing some accounting and your events are a Json
> representing any particular operation:
>
>    1. {"op":"set", "value":0}
>    2. {"op":"add", "value":20}
>    3. {"op":"substract", "value":20}
>
> Then when you reply the events your account total should be zero.
>
> That's the simplest example I could come up with, basically you store each
> Json event and your actor "knows" what to do with such information when it
> is activated.
>
> HTH,
>
> Guido.
>
> On Sunday, March 12, 2017 at 6:03:31 PM UTC, Justin du coeur wrote:
>>
>> Generally not -- you define the "event" as a serializable data structure
>> that *describes* the transformation to execute, and that gets stored in the
>> event stream.  When you reload the Actor, you "replay" those events, and
>> your recovery logic interprets the events to actually change the data.  You
>> generally have a function that takes the stream of events and the starting
>> state, and does this interpretation.
>>
>> In principle, I suppose you *could* save the functions themselves as
>> bytecode, but I don't think I've ever heard of anyone doing so, and it
>> seems quite dangerous -- it could fail to load because dependencies had
>> changed, and other such problems.  (And it would likely be very bulky and
>> redundant.)
>>
>> On Sun, Mar 12, 2017 at 9:59 AM, kant kodali <kant...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> What does it mean when someone says we store the event itself rather
>>> than storing the state/data? such that the events can be replayed to store
>>> the state/data. Does it mean storing the functions/transformation itself
>>> (simply put the JVM byte code for the function itself) ?
>>>
>>> Thanks!
>>> kant
>>>
>>> --
>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c
>>> urrent/additional/faq.html
>>> >>>>>>>>>> Search the archives: https://groups.google.com/grou
>>> p/akka-user
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Akka User List" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to akka-user+...@googlegroups.com.
>>> To post to this group, send email to akka...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/akka-user.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/
> current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to