laravel-event-sourcing
laravel-event-sourcing copied to clipboard
Multi-instance event handlers
The challenge I am facing is to be able to re-use event handlers (especially Reactors) more than once. Not sure if it applies to Projectors though. I need to create single Reactor class and make many instances of it that is being configurable by the end user. This line is preventing me from doing this. It "refreshes" instance from the container effectively cleaning any customizations made to the Reactor object.
There's a comment above this line that reads:
A better solution is to store event handler class names instead of an instantiated version of them in the list of handlers, which requires a larger and complex refactor.
I like that idea as it'd allow me to store aliases to specific instances instead of class names. I think of maybe other solutions to the problem, but this is the simplest one.