Concrete command bus implementing ICommandBus.
CommandBus(behaviors?: readonly IPipelineBehavior[])
Creates a new command bus.
Parameters
optional
behaviors: readonly IPipelineBehavior[]
Behaviors to apply to every command execution (default: [])
readonly
handlerCount: number
The number of registered command handlers.
INTERNAL: not part of the ICommandBus interface.
clear(): void
Clears all registered command handlers.
INTERNAL: not part of the ICommandBus interface.
execute<TResult = unknown>(command: CqrsCommand): Promise<TResult>
Executes a command.
register<TCommand extends CqrsCommand, TResult>(type: string,handler: ICommandHandler<TCommand, TResult>): void
Registers a command handler.
setBehaviors(behaviors: readonly IPipelineBehavior[]): void
Replaces the behavior list.
INTERNAL: not part of the ICommandBus interface.