Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto instantiators #22

Open
boenrobot opened this issue Nov 25, 2019 · 0 comments
Open

Auto instantiators #22

boenrobot opened this issue Nov 25, 2019 · 0 comments

Comments

@boenrobot
Copy link

boenrobot commented Nov 25, 2019

Requiring instantiatiators at module registration makes this module much less extensible than the built in CQRS module.

I realize that the same event class name may appear appear multiple times in different files, so one would need to be picked, or the event would need to be namespaced properly in the store (perhaps by including the full path to the file). To avoid that later part, I think what could be done is to require adding a decorator to event classes that would declare the name in the event store. For simplicity, make it default to the class name, or accept an optional name in the store. Then also require exporting of the events to the event store's scope (similarly to how one has to export the handlers).

This would allow a module to add events and handlers on its own, rather than touching a central location. Also, upon registration of the same stored event, there could be a startup error thrown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant