Does the Node.js client provide support for asynchronous subscription handler functions to be executed sequentially?
The use case is to create a (single) subscription for maintaining a persistent Read Model that requires sequential event processing. The event handler loads the current data, applies a modification and persists the updated data together with a cursor of the processed revision. As this is an asynchronous process, there needs to be a mechanism that queues the handler function executions. Otherwise, the handler might be executed concurrently for multiple events.
So far, I have solved this with a simple (in-memory) queuing mechanism that wraps the handler function (think chained promises). Also, I am aware that there are other possible approaches. One could put a persistent queue in between EventStoreDB and the actual subscriber or shift the responsibility of queuing to the data storage if possible.
I was just wondering if this is something that is already built into the client or might be added at some point.