Reordering of Events or Rewinding?

I am playing with ES for a disconnected client implementation.

We are not taking the approach Greg suggests in his talks (store and forward commands), as if something happens on a disconnected client, it happened.

There is no possibility of rejecting it.

In order to successfully merge these disconnected events some form of re-ordering is required.

i.e. an event is the store at 13:41

an event of the same type occurred on a disconnected client at 13:00

When the client re-connects, their event is older and can not be applied to the end of the stream.

We could discard that event but for completeness of the stream, i’d like to “insert” events into the stream at the appropriate place.

Is there any concept of reordering a stream?

Can you rewind a stream to a particular position?

We store and replay in order given to us (no reordering) however for reading back yourself it would be pretty easy to set a metadata property so your code can reorder. This would be much trickier with projections however to do in order.

We can’t rely on the server being there, so we do our own projections (wouldn’t use ES projections, unless there is an offline functionality i’ve overlooked?)

So the metadata approach is a possibility.

Also considering wrapping Out Of Date events in a new envelope event

Adam

The envelope event can work well (build up as linked list). The tricky part and domain specific which is why we don’t support) is what to do when you are at version 17 and rewrite back version 5… Do you then need to undo everything your projection did put the new v5 and replay forward?