Class CommandHandlingEntry

java.lang.Object
org.axonframework.messaging.unitofwork.AbstractUnitOfWork<T>
org.axonframework.disruptor.commandhandling.DisruptorUnitOfWork<org.axonframework.commandhandling.CommandMessage<?>>
org.axonframework.disruptor.commandhandling.CommandHandlingEntry
All Implemented Interfaces:
org.axonframework.messaging.unitofwork.UnitOfWork<org.axonframework.commandhandling.CommandMessage<?>>

public class CommandHandlingEntry extends DisruptorUnitOfWork<org.axonframework.commandhandling.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

    org.axonframework.messaging.unitofwork.UnitOfWork.Phase
  • Constructor Summary

    Constructors
    Constructor
    Description
    Initializes the CommandHandlingEntry
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the identifier of the aggregate to recover.
    Returns the CommandCallback instance for the executed command.
    org.axonframework.messaging.InterceptorChain
    Returns the InterceptorChain for the invocation process registered with this entry, or null if none is available.
    int
    Returns the Identifier of the invoker that is chosen to handle this entry.
    int
    Returns the Identifier of the publisher that is chosen to handle this entry.
    org.axonframework.messaging.InterceptorChain
    Returns the InterceptorChain for the publication process registered with this entry, or null if none is available.
    org.axonframework.commandhandling.CommandResultMessage<?>
    Returns the result of the command's execution, or null if the command is not yet executed or resulted in an exception.
    boolean
    Indicates whether this entry is a recovery entry.
    void
    registerAggregateIdentifier(String aggregateIdentifier)
    Registers the identifier of the aggregate that will process the next command.
    void
    reset(org.axonframework.commandhandling.CommandMessage<?> newCommand, org.axonframework.messaging.MessageHandler<? super org.axonframework.commandhandling.CommandMessage<?>> newCommandHandler, int newInvokerSegmentId, int newPublisherSegmentId, BlacklistDetectingCallback<?,?> newCallback, List<org.axonframework.messaging.MessageHandlerInterceptor<? super org.axonframework.commandhandling.CommandMessage<?>>> invokerInterceptors, List<org.axonframework.messaging.MessageHandlerInterceptor<? super org.axonframework.commandhandling.CommandMessage<?>>> publisherInterceptors)
    Resets this entry, preparing it for use for another command.
    void
    resetAsCallable(Callable<Object> callable, int newInvokerSegmentId, int newPublisherSegmentId, BlacklistDetectingCallback<Object,Object> newCallback)
    Resets this entry, preparing it to run given callable from within the invocationInterceptorChain.
    void
    resetAsRecoverEntry(String newAggregateIdentifier)
    Resets this entry, preparing it for use as a recovery entry.
    void
    setResult(org.axonframework.commandhandling.CommandResultMessage<?> result)
    Registers the result of the command's execution, if successful.

    Methods inherited from class org.axonframework.messaging.unitofwork.AbstractUnitOfWork

    afterCommit, changePhase, commit, correlationDataProviders, getCorrelationData, isRolledBack, onCleanup, onCommit, onPrepareCommit, onRollback, phase, registerCorrelationDataProvider, resources, rollback, setPhase, start

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods 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

      public org.axonframework.messaging.InterceptorChain getInvocationInterceptorChain()
      Returns the InterceptorChain for the invocation process registered with this entry, or null if none is available.
      Returns:
      the InterceptorChain for the invocation process registered with this entry
    • getPublisherInterceptorChain

      public org.axonframework.messaging.InterceptorChain getPublisherInterceptorChain()
      Returns the InterceptorChain for the publication process registered with this entry, or null if none is available.
      Returns:
      the InterceptorChain for the publication process registered with this entry
    • setResult

      public void setResult(org.axonframework.commandhandling.CommandResultMessage<?> result)
      Registers the result of the command's execution, if successful.
      Parameters:
      result - the result of the command's execution, if successful
    • getResult

      public org.axonframework.commandhandling.CommandResultMessage<?> getResult()
      Returns the result of the command's execution, or null if the command is not yet executed or resulted in an exception.
      Returns:
      the result of the command's execution, if any
    • getCallback

      public BlacklistDetectingCallback<?,?> 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. When true, this entry does not contain any command handling information.
      Returns:
      true if this entry represents a recovery request, otherwise false.
    • getAggregateIdentifier

      public String getAggregateIdentifier()
      Returns the identifier of the aggregate to recover. Returns null when isRecoverEntry() returns false.
      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(org.axonframework.commandhandling.CommandMessage<?> newCommand, org.axonframework.messaging.MessageHandler<? super org.axonframework.commandhandling.CommandMessage<?>> newCommandHandler, int newInvokerSegmentId, int newPublisherSegmentId, BlacklistDetectingCallback<?,?> newCallback, List<org.axonframework.messaging.MessageHandlerInterceptor<? super org.axonframework.commandhandling.CommandMessage<?>>> invokerInterceptors, List<org.axonframework.messaging.MessageHandlerInterceptor<? super org.axonframework.commandhandling.CommandMessage<?>>> publisherInterceptors)
      Resets this entry, preparing it for use for another command.
      Parameters:
      newCommand - The new command the entry is used for
      newCommandHandler - The Command Handler responsible for handling newCommand
      newInvokerSegmentId - The SegmentID of the invoker that should process this entry
      newPublisherSegmentId - The SegmentID of the publisher that should process this entry
      newCallback - The callback to report the result of command execution to
      invokerInterceptors - The interceptors to invoke during the command handler invocation phase
      publisherInterceptors - The interceptors to invoke during the publication phase
    • resetAsRecoverEntry

      public void resetAsRecoverEntry(String newAggregateIdentifier)
      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 given callable from within the invocationInterceptorChain.
      Parameters:
      callable - a Callable which performs a task in the invocationInterceptorChain, for example publishing a scheduled DeadlineMessage
      newInvokerSegmentId - The SegmentId of the invoker that should process this entry
      newPublisherSegmentId - The SegmentId of the publisher that should process this entry
      newCallback - The callback to report the result of command execution to
    • registerAggregateIdentifier

      public void registerAggregateIdentifier(String aggregateIdentifier)
      Registers the identifier of the aggregate that will process the next command.
      Parameters:
      aggregateIdentifier - identifier of the aggregate that will handle the command