@Retention(value=RUNTIME) @Target(value=METHOD) public @interface Assign
A command handler method must:
EventMessageif there is only one event generated; or an
Iterableof event messages for two or more events;
CommandMessageas the first parameter.
A command handler method may accept a
CommandContext as the second parameter, if handling of the command requires its context.
If the annotation is applied to a method which doesn't satisfy any of these requirements, this method is not considered a command handler and is not registered for command dispatching.
A command handler method should have package-private access. It will allow
calling this method from tests. The method should not be
public because it is not
supposed to be called directly.
An application must have one and only one handler per command message class. This includes the case of transforming an incoming command into one or more commands that will to be handled instead of the received one.
Declaring two methods that handle the same command class will result in run-time error.