Now we often mention causal ordering as something that would be a great goal 
for a distributed system, sometime in the future, but never seem to talk about 
achieving it.  To that end I would like to naively suggest a way that it may 
possibly be implemented.

The implementation is to simply require each producer of events tag relevant 
events they produce with a list of events that "caused" the event. This will 
usually be zero, sometimes be one and occasionally more than one event. More on 
the tagging later.

I hypothesis that this information together with the total (local) ordering 
within parts of the event stream could allow the the store or the consumer of 
the events to arrange partial causal ordering (much like they would be able to 
reorder events with global sequence numbers).  

If events are not "caused" by other events then, generally speaking, I think 
their ordering wouldn't be significant to the consumers and so we don't need to 
try and order them.  Of course, for success this relies on the producer tagging 
events when appropriate.  

So, for example, when a producer persists an event A that it knows was "caused 
by" events B and C, it appends to A referenced (globally unique ids) for B and 
C.  Of course, another producer may produce an event D that was "caused by" B, 
so it would append to D a reference (GUID) for B.  

If this is done a partial graph of causal ordering is transmitted with the 
events when the producers think it necessary, since the producer is really in 
the best position to decide what is casual and what is not.  The store or the 
consumer could arrange to provide or consume the events in the right order if 
needed.

I don't think this would be hard or inefficient to implement.  A real event 
could just be wrapped in an envelope class that contained the event and a 
collection of GUID for the causing events.  This envelope could also be where 
other (transparent) information about the event is kept (for the read side etc).

Remember its local ordering (e.g. sequence numbers for each actor's event) plus 
a partial graphs of causal ordering combined that I think could do the trick 
for CQRS.  Does that sound like it could work or am I missing something 
obvious?  I haven't got a proof for any of this ;-)

Cheers,
Ashley.

-- 
>>>>>>>>>>      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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to