I'm submitting a...
[ ] Regression
[ ] Bug report
[x] Feature request
[x] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
It's relatively easy to figure from the docs and looking up the related sources that in order to track event dispatching, one needs to implement a custom publisher.
However, the actual event handlers and saga streams look very opaque... I don't know if there is a way to extend tracking of their execution.
If there isn't a way to track executing, the base classes should be modified to expose the properties that would allow for such tracking to be implemented in extended classes, even if the user can't do this tracking without an extended class.
If there is such a way, it should be documented, along with extending the publisher.
I would be willing to write such an extension guide myself (as an extra recipe?) after I actually make one that can do this sort of tracking.
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
I would like to create a custom event storage mechanism, whereby I track when event handlers were dispatched, when each event handler finished executing, and when all registered sagas related to an event have finished executing.
All of this in an effort to make my application resiliant against application restarts - on restart, the still not safe for deletion events would be re-fed to the application, unfinished handlers would be re-executed (my application will have as a matter of policy that each handler should use only one transaction during its execution, ensuring such re-execution would not result in unexpected results...), and unfinished sagas would wait for the remaining events to appear and execute their respective commands, before the events are marked for deletion.
On a related note, I also have a question that the docs don't make clear... Do sagas even wait for the handlers of an event to finish executing, or is the mere act of dispatching an event enough to trigger all sagas that track it? From reading the sources, it seems like the answer to that is "No, sagas don't wait for event handlers to finish. Sagas are executed as soon as all tracked events are dispatched".
Nest version: latest
For Tooling issues:
- Node version: latest
- Platform: N/A