EventSauce icon indicating copy to clipboard operation
EventSauce copied to clipboard

[WIP] Subscriptions & projection engine

Open Robertbaelde opened this issue 1 year ago • 2 comments

This PR introduces subscriptions and projections to EventSauce.

Subscriptions

Subscriptions are a subscription to a set of messages from the MessageStorage. The simplest form of subscription would be the offset subscription, returning all events since a specific offset. More complex subscriptions can be created, for example on aggregateId or on a specific partition of a stream.

Projections

Currently there are some message consumer interfaces and there is a replay functionality in EventSauce. However oftenly you'd want a projector that is autonomous, and keeps track of its own offset to the stream. This gives more flexibility with replaying projectors, and handling projections in parallel.

Todo:

  • [ ] write more tests
  • [ ] Implement repository for projection state (including locking, wait for lock mechanism)
  • [ ] Build example implementation
  • [ ] Update docs

Robertbaelde avatar May 31 '23 15:05 Robertbaelde

I'm wondering if the Checkpoint should contain the ProjectionId since it's always for that specific, releasing it would then only need to contain the checkpoint. WDYT, @Robertbaelde ?

frankdejonge avatar Jun 05 '23 15:06 frankdejonge

I'm wondering if the Checkpoint should contain the ProjectionId since it's always for that specific, releasing it would then only need to contain the checkpoint. WDYT, @Robertbaelde ?

I see checkpoints as part of a subscription to a stream, and not per-se projection related. So those subscriptions could be used for other stuff than projections (Reactors, process managers, message publisher or other stuff). Happy to discuss further though.

Robertbaelde avatar Jun 05 '23 15:06 Robertbaelde