-
Notifications
You must be signed in to change notification settings - Fork 2
es cqrs.Class.EventBus
@sclable/nestjs-libs / es-cqrs / EventBus
Rate-limited event bus that will put event handlers in a promise chain to avoid concurrency issues on the read side.
This is mainly because insert and update events can come one after another in a rapid succession (especially during replay) and the insert does not finish before the updates, and nothing is updated in the end.
The rate-limiting is based on the aggregate ID.
Note: If an event-handler throws an error, the rest of them will work fine.
-
EventBus
<Event
>
new EventBus(
commandBus
,moduleRef
,unhandledExceptionBus
):EventBus
• commandBus: CommandBus
<ICommand
>
• moduleRef: ModuleRef
• unhandledExceptionBus: UnhandledExceptionBus
<ICommand
| IEvent
>
EventBus<Event>.constructor
node_modules/@nestjs/cqrs/dist/event-bus.d.ts:17
bind(
handler
,id
):void
• handler: IEventHandler
<Event
>
• id: string
void
EventBus.bind