Skip to content

es cqrs.Class.EventBus

Sclable CI edited this page May 20, 2026 · 35 revisions

@sclable/nestjs-libs / es-cqrs / EventBus

Class: EventBus

Defined in: packages/es-cqrs/src/rate-limited-event-bus.ts:19

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.

Extends

Constructors

Constructor

new EventBus(commandBus, moduleRef, unhandledExceptionBus, options?): RateLimitedEventBus

Defined in: node_modules/@nestjs/cqrs/dist/event-bus.d.ts:23

Parameters

commandBus

CommandBus

moduleRef

ModuleRef

unhandledExceptionBus

UnhandledExceptionBus

options?

CqrsModuleOptions

Returns

RateLimitedEventBus

Inherited from

EventBus<Event>.constructor

Methods

bind()

bind(handler, id): void

Defined in: packages/es-cqrs/src/rate-limited-event-bus.ts:22

Parameters

handler

InstanceWrapper<IEventHandler<Event>>

id

string

Returns

void

Overrides

EventBus.bind

Clone this wiki locally