Closed ibosev closed 4 years ago
@ibosev yes I have seen this issue when using the Official CQRS module, it's been low hanging for a while now. See example usage if this library and how I use CQRS module here https://github.com/juicycleff/ultimate-backend/tree/next
Issue 6 has the fix
Hello,
I am trying to hook up your module to handle event sourcing in my project, but event handlers are never called. Events are being persisted in the event store, but I never get to the handle method in my cqrs event handlers. Do you use custom event publisher as daypaio does in his command handlers?
Below are snippets from my code:
command handler:
event impl:
event handler:
es module register:
Edit: 1) I can confirm that normally without event-sourcing module events are being handled correctly - handle method in event handler is being called as expected. This is when using
this.publisher.mergeObjectContext()
and thencommit()
on aggregate root.2) If I use EventBus directly and publish events from it, they are being handled as well:
this.eventBus.publish(new UserCreatedEvent(userAggregate));
So the issue has something to do with EventPublisher from @nestjs/cqrs.