-
Hi all, I’d like to express my thanks to the amazing efforts put in this repository. NestJS provides an event pub/sub at "nestjs/event-emitter" and an event bus at "nestjs/cqrs", I'm a bit of confused about when and where to use "nestjs/event-emitter" and CQRS EventBus (nestjs/cqrs)? Seems others also had same question from this post (nestjs/event-emitter#44), Can anyone shed some light on this please? Appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Event emitter from For that reason event emitter from |
Beta Was this translation helpful? Give feedback.
Event emitter from
nestjs/cqrs
as far as I remember does not let youawait
for all events to finish, it's fire and forget. It means that if something crashes in the middle, event will be lost.nestjs/event-emitter
allows you toawait
for all events to execute, so we can save everything as a part of a transaction. This way no event is lost, if something fails in the middle entire transaction will be aborted (all or nothing).For that reason event emitter from
nestjs/cqrs
is not used and I don't recommend using it.