org.axonframework.commandhandling.annotation
Annotation Type CommandHandler


@Documented
@Retention(value=RUNTIME)
@Target(value={METHOD,CONSTRUCTOR})
public @interface CommandHandler

Marker annotation to mark any method on an object as being a CommandHandler. Use the AnnotationCommandHandlerAdapter to subscribe the annotated class to the command bus.

Alternatively, the annotations may be placed on an AggregateRoot, in which case the AggregateAnnotationCommandHandler can be used to subscribe the handlers to the command bus. When the annotation appears on an Aggregate's constructor, that command will cause a new aggregate to be created and stored in the repository provided with the AggregateAnnotationCommandHandler.

The annotated method's first parameter is the command handled by that method. Optionally, the command handler may specify a second parameter of type UnitOfWork. The active Unit of Work will be passed if that parameter is supplied.

Since:
0.5
Author:
Allard Buijze

Optional Element Summary
 String commandName
          The name of the Command this handler listens to.
 

commandName

public abstract String commandName
The name of the Command this handler listens to. Defaults to the fully qualified class name of the payload type (i.e. first parameter).

Default:
""


Copyright © 2010-2012. All Rights Reserved.