Create a command instance from a CommandConfig
The command configuration
OptionalgetGet a handler associated with a command
The command class
the handler for the command class
Execute the given command with it's registered command handler
command to execute
result from the command handler
Check if a command is supported
identifier of the command. Can be either the class or the string the class was registered with
true if the command is supported, false otherwise
Register a command to be executed by the given handler.
Associates a command class with a handler that will process instances of that command when CommandBus.handle is called.
The command class to register
The CommandHandler instance that will execute the command
BetaRegister a command to be executed by the given handler
type of command
the handler instance used to execute the command
Optionalmetadata: Omit<CommandMetadata, "id">metadata for the command
Service for registering and executing commands using the command pattern.
The CommandBus is the central hub for the command pattern implementation. It manages command registration, handler lookup, and command execution. Commands are decoupled from their handlers, allowing for flexible middleware chains and cross-cutting concerns like logging, validation, and authorization.
Key responsibilities:
Example
Example
See