Abstract Command Handler
public abstract class AbstractCommandHandler extends AbstractCommandDispatcher implements CommandHandler
The abstract base for non-aggregate classes that expose command handling methods and post their results to EventBus.
A command handler is responsible for:
- Changing the state of the business model in response to a command. This is done by one of the command handling methods to which the handler dispatches the command.
- Producing corresponding events.
- Posting events to
EventBus
.
Event messages are returned as values of command handling methods.
A command handler does not have its own state. So the state of the business model it changes is external to it. Even though such behaviour may be needed in some rare cases, using aggregates is a preferred way of handling commands.
This class implements CommandDispatcher
dispatching messages to methods declared in the derived classes.
See also
Aggregate
Functions
Link copied to clipboard
Dispatches the command to the handler method and posts resulting events to the EventBus.
Link copied to clipboard
Obtains a set of message classes that can be processed by this dispatcher.
Link copied to clipboard
Obtains classes of the events produced by this object.
Link copied to clipboard
Registers this instance as a part of the given Bounded Context.
Inherited functions
Link copied to clipboard
Checks if this dispatcher can dispatch the given message.
Link copied to clipboard
Verifies that this instance is NOT registered yet.
Link copied to clipboard
Verifies that this instance is already registered.
Link copied to clipboard
Verifies if this instance dispatches at least one command.
Link copied to clipboard
Determines if this instance is already registered with a Bounded Context.
Link copied to clipboard
protected void onRejection(SignalEnvelope<? extends Object, ? extends Object, ? extends Object> signal, Event rejection)
Link copied to clipboard
Posts passed events to EventBus.
Link copied to clipboard
Obtains ID packed into
Any
for being used in generated events.