IDomainEventPublisher
Defined in: packages/ddd-core/application/ports/domain-event-publisher.port.ts:20
Publishes the buffered domain events of an aggregate after a command succeeds.
Any bus with a publishAll(events) method fits, including the NestJS CQRS
EventBus, so a Nest handler passes its injected EventBus unchanged.
CommandBaseHandler passes the aggregate as dispatcherContext, which the
NestJS EventBus hands to its configured publisher.
Example
Section titled “Example”const publisher: IDomainEventPublisher = { publishAll: (events) => events.forEach((event) => emitter.emit('event', event)),};Methods
Section titled “Methods”publishAll()
Section titled “publishAll()”publishAll(
events,dispatcherContext?):unknown
Defined in: packages/ddd-core/application/ports/domain-event-publisher.port.ts:21
Parameters
Section titled “Parameters”events
Section titled “events”IEvent[]
dispatcherContext?
Section titled “dispatcherContext?”unknown
Returns
Section titled “Returns”unknown