Skip to content

es cqrs.EventBus

Sclable CI edited this page Sep 11, 2024 · 198 revisions

Class: EventBus

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.

Hierarchy

  • EventBus<Event>

    EventBus

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new EventBus(commandBus, moduleRef, unhandledExceptionBus): EventBus

Parameters

Name Type
commandBus CommandBus<ICommand>
moduleRef ModuleRef
unhandledExceptionBus UnhandledExceptionBus<ICommand | IEvent>

Returns

EventBus

Inherited from

EventBus<Event>.constructor

Defined in

node_modules/@nestjs/cqrs/dist/event-bus.d.ts:17

Properties

limits

Private limits: Object = {}

Index signature

▪ [key: string]: Limit

Defined in

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

Methods

bind

bind(handler, id): void

Parameters

Name Type
handler IEventHandler<Event>
id string

Returns

void

Overrides

EventBus.bind

Defined in

packages/es-cqrs/src/rate-limited-event-bus.ts:21

Clone this wiki locally