Process managers currently persist their state after each handled event. They also use a single all stream subscription to route events to an instance and for the instance to handle the event.
The next release of EventStore has support for linking events. This feature makes it possible to use event sourcing to build a process manager instance's state. Events can be linked from the source stream to a stream dedicated to the process manager instance. To rebuild its state will require fetching and applying the events, exactly as aggregates work.
Using a stream of linked events will also allow individual process manager instances to have their own subscription to their own stream of events. This will allow instances to process events concurrently, rather than being blocked by each other. The process router will still use an all stream subscription, but it will now just be linking events to the target instance's event stream. The instance's own subscription will trigger its event handling and command dispatch.
Due to the potentially large number of process manager instances running they should be automatically shutdown after an inactivity timeout period (#148).
The benefit of this approach is that event sourcing allows state to be modified by changing the process manager behaviour and rebuilding. Whereas currently the state cannot be amended from historical events.
It should still be possible to snapshot process manager instance state using the same snapshot behaviour as aggregates.
The text was updated successfully, but these errors were encountered: