|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.axonframework.commandhandling.annotation.AggregateAnnotationCommandHandler<T>
T - the type of aggregate this handler handles commands forpublic class AggregateAnnotationCommandHandler<T extends AggregateRoot>
Command handler that handles commands based on CommandHandler
annotations on an aggregate. Those annotations may appear on methods, in which case a specific aggregate instance
needs to be targeted by the command, or on the constructor. The latter will create a new Aggregate instance, which
is then stored in the repository.
| Constructor Summary | |
|---|---|
AggregateAnnotationCommandHandler(Class<T> aggregateType,
Repository<T> repository)
Initializes an AnnotationCommandHandler based on the annotations on given aggregateType, using the
given repository to add and load aggregate instances. |
|
AggregateAnnotationCommandHandler(Class<T> aggregateType,
Repository<T> repository,
CommandBus commandBus)
Deprecated. Use AggregateAnnotationCommandHandler(Class, org.axonframework.repository.Repository)
and subscribe the adapter to the command bus using
CommandBus.subscribe(String,
org.axonframework.commandhandling.CommandHandler). Alternatively, use
subscribe(Class, org.axonframework.repository.Repository, org.axonframework.commandhandling.CommandBus). |
|
AggregateAnnotationCommandHandler(Class<T> aggregateType,
Repository<T> repository,
CommandBus commandBus,
CommandTargetResolver commandTargetResolver)
Deprecated. Use AggregateAnnotationCommandHandler(Class, org.axonframework.repository.Repository,
org.axonframework.commandhandling.CommandTargetResolver) and subscribe the handler to the command
bus using CommandBus.subscribe(String,
org.axonframework.commandhandling.CommandHandler). Alternatively, use
subscribe(Class, org.axonframework.repository.Repository, org.axonframework.commandhandling.CommandBus,
org.axonframework.commandhandling.CommandTargetResolver). |
|
AggregateAnnotationCommandHandler(Class<T> aggregateType,
Repository<T> repository,
CommandTargetResolver commandTargetResolver)
Initializes an AnnotationCommandHandler based on the annotations on given aggregateType, using the
given repository to add and load aggregate instances and the default ParameterResolverFactory. |
|
AggregateAnnotationCommandHandler(Class<T> aggregateType,
Repository<T> repository,
CommandTargetResolver commandTargetResolver,
ParameterResolverFactory parameterResolverFactory)
Initializes an AnnotationCommandHandler based on the annotations on given aggregateType, using the
given repository to add and load aggregate instances and the given
parameterResolverFactory. |
|
| Method Summary | ||
|---|---|---|
Object |
handle(CommandMessage<Object> commandMessage,
UnitOfWork unitOfWork)
Handles the given command. |
|
protected Object |
resolveReturnValue(CommandMessage<?> command,
T createdAggregate)
Resolves the value to return when the given command has created the given aggregate. |
|
void |
subscribe()
Deprecated. subscribing this handler should be done using CommandBus.subscribe(String,
org.axonframework.commandhandling.CommandHandler). Retrieve the supported commands with supportedCommands(). |
|
static void |
subscribe(AggregateAnnotationCommandHandler<?> aggregateAnnotationCommandHandler,
CommandBus commandBus)
Subscribe the given aggregateAnnotationCommandHandler to the given commandBus. |
|
static
|
subscribe(Class<T> aggregateType,
Repository<T> repository,
CommandBus commandBus)
Subscribe a handler for the given aggregate type to the given command bus. |
|
static
|
subscribe(Class<T> aggregateType,
Repository<T> repository,
CommandBus commandBus,
CommandTargetResolver commandTargetResolver)
Subscribe a handler for the given aggregate type to the given command bus. |
|
Set<String> |
supportedCommands()
Returns the set of commands supported by the annotated command handler managed by this adapter. |
|
void |
unsubscribe()
Deprecated. unsubscribing this handler should be done using CommandBus.unsubscribe(String,
org.axonframework.commandhandling.CommandHandler). Retrieve the supported commands with supportedCommands(). |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AggregateAnnotationCommandHandler(Class<T> aggregateType,
Repository<T> repository)
aggregateType, using the
given repository to add and load aggregate instances.
aggregateType - The type of aggregaterepository - The repository providing access to aggregate instances
public AggregateAnnotationCommandHandler(Class<T> aggregateType,
Repository<T> repository,
CommandTargetResolver commandTargetResolver)
aggregateType, using the
given repository to add and load aggregate instances and the default ParameterResolverFactory.
aggregateType - The type of aggregaterepository - The repository providing access to aggregate instancescommandTargetResolver - The target resolution strategy
public AggregateAnnotationCommandHandler(Class<T> aggregateType,
Repository<T> repository,
CommandTargetResolver commandTargetResolver,
ParameterResolverFactory parameterResolverFactory)
aggregateType, using the
given repository to add and load aggregate instances and the given
parameterResolverFactory.
aggregateType - The type of aggregaterepository - The repository providing access to aggregate instancescommandTargetResolver - The target resolution strategyparameterResolverFactory - The strategy for resolving parameter values for handler methods
@Deprecated
public AggregateAnnotationCommandHandler(Class<T> aggregateType,
Repository<T> repository,
CommandBus commandBus)
AggregateAnnotationCommandHandler(Class, org.axonframework.repository.Repository)
and subscribe the adapter to the command bus using
CommandBus.subscribe(String,
org.axonframework.commandhandling.CommandHandler). Alternatively, use
subscribe(Class, org.axonframework.repository.Repository, org.axonframework.commandhandling.CommandBus).
aggregateType, to be
registered on the given commandBus.
aggregateType - The type of aggregaterepository - The repository providing access to aggregate instancescommandBus - The command bus to register command handlers to
@Deprecated
public AggregateAnnotationCommandHandler(Class<T> aggregateType,
Repository<T> repository,
CommandBus commandBus,
CommandTargetResolver commandTargetResolver)
AggregateAnnotationCommandHandler(Class, org.axonframework.repository.Repository,
org.axonframework.commandhandling.CommandTargetResolver) and subscribe the handler to the command
bus using CommandBus.subscribe(String,
org.axonframework.commandhandling.CommandHandler). Alternatively, use
subscribe(Class, org.axonframework.repository.Repository, org.axonframework.commandhandling.CommandBus,
org.axonframework.commandhandling.CommandTargetResolver).
aggregateType, to be
registered on the given commandBus.
aggregateType - The type of aggregaterepository - The repository providing access to aggregate instancescommandBus - The command bus to register command handlers tocommandTargetResolver - The target resolution strategy| Method Detail |
|---|
public static <T extends AggregateRoot> AggregateAnnotationCommandHandler subscribe(Class<T> aggregateType,
Repository<T> repository,
CommandBus commandBus)
T - The type of aggregate this handler handles commands foraggregateType - The type of aggregaterepository - The repository providing access to aggregate instancescommandBus - The command bus to register command handlers to
public static <T extends AggregateRoot> AggregateAnnotationCommandHandler subscribe(Class<T> aggregateType,
Repository<T> repository,
CommandBus commandBus,
CommandTargetResolver commandTargetResolver)
T - The type of aggregate this handler handles commands foraggregateType - The type of aggregaterepository - The repository providing access to aggregate instancescommandBus - The command bus to register command handlers tocommandTargetResolver - The target resolution strategy
public static void subscribe(AggregateAnnotationCommandHandler<?> aggregateAnnotationCommandHandler,
CommandBus commandBus)
aggregateAnnotationCommandHandler to the given commandBus. The
command handler will be subscribed for each of the supported commands.
aggregateAnnotationCommandHandler - The fully configured AggregateAnnotationCommandHandler instance to
subscribecommandBus - The command bus instance to subscribe to@PreDestroy @Deprecated public void unsubscribe()
CommandBus.unsubscribe(String,
org.axonframework.commandhandling.CommandHandler). Retrieve the supported commands with supportedCommands().
unsubscribe in interface Subscribable@PostConstruct @Deprecated public void subscribe()
CommandBus.subscribe(String,
org.axonframework.commandhandling.CommandHandler). Retrieve the supported commands with supportedCommands().
subscribe in interface Subscribablepublic Set<String> supportedCommands()
public Object handle(CommandMessage<Object> commandMessage,
UnitOfWork unitOfWork)
throws Throwable
CommandHandlercommand.
handle in interface CommandHandler<Object>commandMessage - The message carrying the command to process.unitOfWork - The UnitOfWork the command is processed in
Throwable - any exception that occurs during command handling
protected Object resolveReturnValue(CommandMessage<?> command,
T createdAggregate)
command has created the given aggregate.
This implementation returns the identifier of the created aggregate.
This method may be overridden to change the return value of this Command Handler
command - The command being executedcreatedAggregate - The aggregate that has been created as a result of the command
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||