I am using EventStore for my local DDD entity storage.
I also plan to use it for storing external events, these events are sequenced externally (as an integer) and grouped by guid of the generating entity. I am planning to put the external sequence in the header metadata.
Events could arrive out of sequence, i.e. 1, 2, 3, 6, 7, 4, 5, 8
If i put these in the EventStore in the above order, I would get the mapping of local to external sequences (using the above as an example) as follows:
{1 => 1}, {2 => 2}, {3=> 3}, {4 => 6}, {5 => 7}, {6 => 4}, {7 => 5}, {8 => 8}
I need to be able to query at any point in time and retrieve a list of sorted events (by the external serquence number) with the same data and metadata just as if i were accessing the stream directly (but ordered by metadata, as opposed to the order it was inserted).
Being very new to EventStore would I be right to start looking at Projections, or would is the only way by implementing wrapper code around the store?
If it is possible using projections would someone be kind enough to give some pointers on how the function would look?