public abstract class AbstractCommandHandler extends AbstractCommandDispatcher implements CommandHandler
A command handler is responsible for:
Event messages are returned as values of command handling methods.
A command handler does not have own state. So the state of the business model it changes is external to it. Even though such a 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.
|Modifier||Constructor and Description|
Creates a new instance of the command handler.
|Modifier and Type||Method and Description|
Dispatches the command to the handler method and posts resulting events to the
Obtains a set of message classes that can be processed by this dispatcher.
Always returns empty version.
equals, getId, getProducerId, hashCode, onError, postEvents
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
protected AbstractCommandHandler(EventBus eventBus)
EventBusto post events generated by this handler
public java.lang.String dispatch(io.spine.core.CommandEnvelope envelope)
envelope- the command to dispatch
java.lang.IllegalStateException- if an exception occurred during command dispatching with this exception as the cause
public java.util.Set<io.spine.core.CommandClass> getMessageClasses()