Class DisruptorUnitOfWork<T extends org.axonframework.messaging.Message<?>>

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

public abstract class DisruptorUnitOfWork<T extends org.axonframework.messaging.Message<?>> extends org.axonframework.messaging.unitofwork.AbstractUnitOfWork<T>
Specialized UnitOfWork instance for the DisruptorCommandBus. It expects the executing command message to target a single aggregate instance.
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
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    addHandler(org.axonframework.messaging.unitofwork.UnitOfWork.Phase phase, Consumer<org.axonframework.messaging.unitofwork.UnitOfWork<T>> handler)
     
    <R> org.axonframework.messaging.ResultMessage<R>
    executeWithResult(Callable<R> task, org.axonframework.messaging.unitofwork.RollbackConfiguration rollbackConfiguration)
    org.axonframework.messaging.unitofwork.ExecutionResult
     
     
    protected void
    notifyHandlers(org.axonframework.messaging.unitofwork.UnitOfWork.Phase phase)
     
    Optional<org.axonframework.messaging.unitofwork.UnitOfWork<?>>
     
    void
    Pause this Unit of Work by deregistering it with the CurrentUnitOfWork.
    void
    reset(T message)
    Resets the state of this Unit of Work, by setting its phase to NOT_STARTED, replacing the message of this Unit of Work with given message, and clearing its collection of registered handlers.
    void
    Resume a paused Unit of Work by registering it with the CurrentUnitOfWork.
    protected void
    setExecutionResult(org.axonframework.messaging.unitofwork.ExecutionResult executionResult)
     
    protected void
     
    org.axonframework.messaging.unitofwork.UnitOfWork<T>
    transformMessage(Function<T,? extends org.axonframework.messaging.Message<?>> transformOperator)
     

    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

    • DisruptorUnitOfWork

      public DisruptorUnitOfWork()
  • Method Details

    • reset

      public void reset(T message)
      Resets the state of this Unit of Work, by setting its phase to NOT_STARTED, replacing the message of this Unit of Work with given message, and clearing its collection of registered handlers.
      Parameters:
      message - the new Message that is about to be processed.
    • pause

      public void pause()
      Pause this Unit of Work by deregistering it with the CurrentUnitOfWork. This will detach it from the current thread.
    • resume

      public void resume()
      Resume a paused Unit of Work by registering it with the CurrentUnitOfWork. This will attach it to the current thread again.
    • parent

      public Optional<org.axonframework.messaging.unitofwork.UnitOfWork<?>> parent()
      Specified by:
      parent in interface org.axonframework.messaging.unitofwork.UnitOfWork<T extends org.axonframework.messaging.Message<?>>
      Overrides:
      parent in class org.axonframework.messaging.unitofwork.AbstractUnitOfWork<T extends org.axonframework.messaging.Message<?>>
    • getMessage

      public T getMessage()
    • transformMessage

      public org.axonframework.messaging.unitofwork.UnitOfWork<T> transformMessage(Function<T,? extends org.axonframework.messaging.Message<?>> transformOperator)
    • notifyHandlers

      protected void notifyHandlers(org.axonframework.messaging.unitofwork.UnitOfWork.Phase phase)
      Specified by:
      notifyHandlers in class org.axonframework.messaging.unitofwork.AbstractUnitOfWork<T extends org.axonframework.messaging.Message<?>>
    • addHandler

      protected void addHandler(org.axonframework.messaging.unitofwork.UnitOfWork.Phase phase, Consumer<org.axonframework.messaging.unitofwork.UnitOfWork<T>> handler)
      Specified by:
      addHandler in class org.axonframework.messaging.unitofwork.AbstractUnitOfWork<T extends org.axonframework.messaging.Message<?>>
    • setExecutionResult

      protected void setExecutionResult(org.axonframework.messaging.unitofwork.ExecutionResult executionResult)
      Specified by:
      setExecutionResult in class org.axonframework.messaging.unitofwork.AbstractUnitOfWork<T extends org.axonframework.messaging.Message<?>>
    • setRollbackCause

      protected void setRollbackCause(Throwable cause)
      Specified by:
      setRollbackCause in class org.axonframework.messaging.unitofwork.AbstractUnitOfWork<T extends org.axonframework.messaging.Message<?>>
    • executeWithResult

      public <R> org.axonframework.messaging.ResultMessage<R> executeWithResult(Callable<R> task, @Nonnull org.axonframework.messaging.unitofwork.RollbackConfiguration rollbackConfiguration)

      This feature is not supported by this Unit of Work.

    • getExecutionResult

      public org.axonframework.messaging.unitofwork.ExecutionResult getExecutionResult()