Interface CommandHandlerRegistry<S extends CommandHandlerRegistry<S>>
- Type Parameters:
S- The type of the registry itself, used for fluent interfacing.
- All Known Subinterfaces:
CommandBus
- All Known Implementing Classes:
DistributedCommandBus,InterceptingCommandBus,RecordingCommandBus,RecordingCommandBus,RetryingCommandBus,SimpleCommandBus,SimpleCommandHandlingComponent,TracingCommandBus
command handlers.- Since:
- 5.0.0
- Author:
- Allard Buijze, Gerard Klijs, Milan Savic, Mitchell Herrijgers, Sara Pellegrini, Steven van Beelen
-
Method Summary
Modifier and TypeMethodDescriptiondefault Ssubscribe(Set<QualifiedName> names, CommandHandler commandHandler) default Ssubscribe(CommandHandlingComponent handlingComponent) Subscribe the givenhandlingComponentwith this registry.subscribe(QualifiedName name, CommandHandler commandHandler)
-
Method Details
-
subscribe
Subscribe the givenhandlerforcommandsof the givenname.If a subscription already exists for the
name, the behavior is undefined. Implementations may throw an exception to refuse duplicate subscription or alternatively decide whether the existing or newhandlergets the subscription.- Parameters:
name- The name the givencommandHandlercan handle.commandHandler- The handler instance that handlescommandsfor the given name.- Returns:
- This registry for fluent interfacing.
-
subscribe
Subscribe the givenhandlerforcommandsof the givennames.If a subscription already exists for any
namein the given set, the behavior is undefined. Implementations may throw an exception to refuse duplicate subscription or alternatively decide whether the existing or newhandlergets the subscription.- Parameters:
names- The names of the givencommandHandlercan handle.commandHandler- The handler instance that handlescommandsfor the given names.- Returns:
- This registry for fluent interfacing.
-
subscribe
Subscribe the givenhandlingComponentwith this registry.Typically invokes
subscribe(Set, CommandHandler), using theCommandHandlingComponent.supportedCommands()as the set of compatiblenamesthe component in question can deal with.If a subscription already exists for any
namein the supported command names, the behavior is undefined. Implementations may throw an exception to refuse duplicate subscription or alternatively decide whether the existing or newhandlergets the subscription.- Parameters:
handlingComponent- The command handling component instance to subscribe with this registry.- Returns:
- This registry for fluent interfacing.
-