public class AnnotationCommandHandlerAdapter extends Object implements MessageHandler<CommandMessage<?>>, SupportedCommandNamesAware
@CommandHandler annotated bean into a MessageHandler implementation. Each annotated method is subscribed
as a CommandHandler at the CommandBus for the command type specified by the parameter of that method.CommandHandler| Constructor and Description |
|---|
AnnotationCommandHandlerAdapter(Object annotatedCommandHandler)
Wraps the given
annotatedCommandHandler, allowing it to be subscribed to a Command Bus. |
AnnotationCommandHandlerAdapter(Object annotatedCommandHandler,
ParameterResolverFactory parameterResolverFactory)
Wraps the given
annotatedCommandHandler, allowing it to be subscribed to a Command Bus. |
AnnotationCommandHandlerAdapter(Object annotatedCommandHandler,
ParameterResolverFactory parameterResolverFactory,
HandlerDefinition handlerDefinition)
Wraps the given
annotatedCommandHandler, allowing it to be subscribed to a Command Bus. |
| Modifier and Type | Method and Description |
|---|---|
Object |
handle(CommandMessage<?> command)
Invokes the @CommandHandler annotated method that accepts the given
command. |
Registration |
subscribe(CommandBus commandBus)
Subscribe this command handler to the given
commandBus. |
Set<String> |
supportedCommandNames()
Returns the set of command names this component supports.
|
public AnnotationCommandHandlerAdapter(Object annotatedCommandHandler)
annotatedCommandHandler, allowing it to be subscribed to a Command Bus.annotatedCommandHandler - The object containing the @CommandHandler annotated methodspublic AnnotationCommandHandlerAdapter(Object annotatedCommandHandler, ParameterResolverFactory parameterResolverFactory)
annotatedCommandHandler, allowing it to be subscribed to a Command Bus.annotatedCommandHandler - The object containing the @CommandHandler annotated methodsparameterResolverFactory - The strategy for resolving handler method parameter valuespublic AnnotationCommandHandlerAdapter(Object annotatedCommandHandler, ParameterResolverFactory parameterResolverFactory, HandlerDefinition handlerDefinition)
annotatedCommandHandler, allowing it to be subscribed to a Command Bus.annotatedCommandHandler - The object containing the @CommandHandler annotated methodsparameterResolverFactory - The strategy for resolving handler method parameter valueshandlerDefinition - The handler definition used to create concrete handlerspublic Registration subscribe(CommandBus commandBus)
commandBus. The command handler will be subscribed
for each of the supported commands.commandBus - The command bus instance to subscribe topublic Object handle(CommandMessage<?> command) throws Exception
command.handle in interface MessageHandler<CommandMessage<?>>command - The command to handlenull when the annotated handler has a
void return value.NoHandlerForCommandException - when no handler is found for given command.Exception - any exception occurring while handling the commandpublic Set<String> supportedCommandNames()
SupportedCommandNamesAwaresupportedCommandNames in interface SupportedCommandNamesAwareCopyright © 2010–2018. All rights reserved.