Interface CommandBus
- All Superinterfaces:
CommandHandlerRegistry<CommandBus>,DescribableComponent
- All Known Implementing Classes:
DistributedCommandBus,InterceptingCommandBus,RecordingCommandBus,RecordingCommandBus,RetryingCommandBus,SimpleCommandBus,TracingCommandBus
The mechanism that dispatches
commands to their appropriate
command handler.
Command handlers can subscribe to the command bus to handle
commands matching the QualifiedName in the command type.
Hence, commands dispatched match a command handler based on
"command name."
Only a single handler may be subscribed for a given command name at any time.
- Since:
- 0.5
- Author:
- Allard Buijze
-
Method Summary
Modifier and TypeMethodDescriptiondispatch(CommandMessage command, ProcessingContext processingContext) Methods inherited from interface org.axonframework.messaging.commandhandling.CommandHandlerRegistry
subscribe, subscribe, subscribeMethods inherited from interface org.axonframework.common.infra.DescribableComponent
describeTo
-
Method Details
-
dispatch
CompletableFuture<CommandResultMessage> dispatch(@Nonnull CommandMessage command, @Nullable ProcessingContext processingContext) Dispatch the givencommandto thecommand handlersubscribedto the givencommand's name. The name is typically deferred from theMessage.type(), which contains aMessageType.qualifiedName().- Parameters:
command- The command to dispatch.processingContext- The processing context under which the command is being published (can benull).- Returns:
- The
CompletableFutureproviding the result of the command, once finished. - Throws:
NoHandlerForCommandException- when nocommand handleris registered for the givencommand's name.
-