Class CommandHandlingEntry
java.lang.Object
org.axonframework.messaging.unitofwork.AbstractUnitOfWork<CommandMessage<?>>
org.axonframework.disruptor.commandhandling.DisruptorUnitOfWork<CommandMessage<?>>
org.axonframework.disruptor.commandhandling.CommandHandlingEntry
- All Implemented Interfaces:
UnitOfWork<CommandMessage<?>>
DataHolder for the DisruptorCommandBus. The CommandHandlingEntry maintains all information required for or produced
by the command handling process.
- Since:
- 2.0
- Author:
- Allard Buijze
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.axonframework.messaging.unitofwork.UnitOfWork
UnitOfWork.Phase -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the identifier of the aggregate to recover.Returns the CommandCallback instance for the executed command.Returns the InterceptorChain for the invocation process registered with this entry, ornullif none is available.intReturns the Identifier of the invoker that is chosen to handle this entry.intReturns the Identifier of the publisher that is chosen to handle this entry.Returns the InterceptorChain for the publication process registered with this entry, ornullif none is available.Returns the result of the command's execution, ornullif the command is not yet executed or resulted in an exception.booleanIndicates whether this entry is a recovery entry.voidregisterAggregateIdentifier(String aggregateIdentifier) Registers the identifier of the aggregate that will process the next command.voidreset(CommandMessage<?> newCommand, MessageHandler<? super CommandMessage<?>> newCommandHandler, int newInvokerSegmentId, int newPublisherSegmentId, BlacklistDetectingCallback<?, ?> newCallback, List<MessageHandlerInterceptor<? super CommandMessage<?>>> invokerInterceptors, List<MessageHandlerInterceptor<? super CommandMessage<?>>> publisherInterceptors) Resets this entry, preparing it for use for another command.voidresetAsCallable(Callable<Object> callable, int newInvokerSegmentId, int newPublisherSegmentId, BlacklistDetectingCallback<Object, Object> newCallback) Resets this entry, preparing it to run givencallablefrom within theinvocationInterceptorChain.voidresetAsRecoverEntry(String newAggregateIdentifier) Resets this entry, preparing it for use as a recovery entry.voidsetResult(CommandResultMessage<?> result) Registers the result of the command's execution, if successful.Methods inherited from class org.axonframework.disruptor.commandhandling.DisruptorUnitOfWork
addHandler, executeWithResult, getExecutionResult, getMessage, notifyHandlers, parent, pause, reset, resume, setExecutionResult, setRollbackCause, transformMessageMethods inherited from class org.axonframework.messaging.unitofwork.AbstractUnitOfWork
afterCommit, changePhase, commit, correlationDataProviders, getCorrelationData, isRolledBack, onCleanup, onCommit, onPrepareCommit, onRollback, phase, registerCorrelationDataProvider, resources, rollback, setPhase, startMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.messaging.unitofwork.UnitOfWork
attachTransaction, execute, execute, executeWithResult, getOrComputeResource, getOrDefaultResource, getResource, isActive, isCurrent, isRoot, rollback, root
-
Constructor Details
-
CommandHandlingEntry
public CommandHandlingEntry()Initializes the CommandHandlingEntry
-
-
Method Details
-
getInvocationInterceptorChain
Returns the InterceptorChain for the invocation process registered with this entry, ornullif none is available.- Returns:
- the InterceptorChain for the invocation process registered with this entry
-
getPublisherInterceptorChain
Returns the InterceptorChain for the publication process registered with this entry, ornullif none is available.- Returns:
- the InterceptorChain for the publication process registered with this entry
-
setResult
Registers the result of the command's execution, if successful.- Parameters:
result- the result of the command's execution, if successful
-
getResult
Returns the result of the command's execution, ornullif the command is not yet executed or resulted in an exception.- Returns:
- the result of the command's execution, if any
-
getCallback
Returns the CommandCallback instance for the executed command.- Returns:
- the CommandCallback instance for the executed command
-
isRecoverEntry
public boolean isRecoverEntry()Indicates whether this entry is a recovery entry. Whentrue, this entry does not contain any command handling information.- Returns:
trueif this entry represents a recovery request, otherwisefalse.
-
getAggregateIdentifier
Returns the identifier of the aggregate to recover. ReturnsnullwhenisRecoverEntry()returnsfalse.- Returns:
- the identifier of the aggregate to recover
-
getInvokerId
public int getInvokerId()Returns the Identifier of the invoker that is chosen to handle this entry.- Returns:
- the Identifier of the invoker that is chosen to handle this entry
-
getPublisherId
public int getPublisherId()Returns the Identifier of the publisher that is chosen to handle this entry.- Returns:
- the Identifier of the publisher that is chosen to handle this entry
-
reset
public void reset(CommandMessage<?> newCommand, MessageHandler<? super CommandMessage<?>> newCommandHandler, int newInvokerSegmentId, int newPublisherSegmentId, BlacklistDetectingCallback<?, ?> newCallback, List<MessageHandlerInterceptor<? super CommandMessage<?>>> invokerInterceptors, List<MessageHandlerInterceptor<? super CommandMessage<?>>> publisherInterceptors) Resets this entry, preparing it for use for another command.- Parameters:
newCommand- The new command the entry is used fornewCommandHandler- The Command Handler responsible for handlingnewCommandnewInvokerSegmentId- The SegmentID of the invoker that should process this entrynewPublisherSegmentId- The SegmentID of the publisher that should process this entrynewCallback- The callback to report the result of command execution toinvokerInterceptors- The interceptors to invoke during the command handler invocation phasepublisherInterceptors- The interceptors to invoke during the publication phase
-
resetAsRecoverEntry
Resets this entry, preparing it for use as a recovery entry.- Parameters:
newAggregateIdentifier- The identifier of the aggregate to recover
-
resetAsCallable
public void resetAsCallable(Callable<Object> callable, int newInvokerSegmentId, int newPublisherSegmentId, BlacklistDetectingCallback<Object, Object> newCallback) Resets this entry, preparing it to run givencallablefrom within theinvocationInterceptorChain.- Parameters:
callable- aCallablewhich performs a task in theinvocationInterceptorChain, for example publishing a scheduledDeadlineMessagenewInvokerSegmentId- The SegmentId of the invoker that should process this entrynewPublisherSegmentId- The SegmentId of the publisher that should process this entrynewCallback- The callback to report the result of command execution to
-
registerAggregateIdentifier
Registers the identifier of the aggregate that will process the next command.- Parameters:
aggregateIdentifier- identifier of the aggregate that will handle the command
-