Enum Class UnitOfWork.Phase

java.lang.Object
java.lang.Enum<UnitOfWork.Phase>
org.axonframework.messaging.unitofwork.UnitOfWork.Phase
All Implemented Interfaces:
Serializable, Comparable<UnitOfWork.Phase>, Constable
Enclosing interface:
UnitOfWork<T extends Message<?>>

public static enum UnitOfWork.Phase extends Enum<UnitOfWork.Phase>
Enum indicating possible phases of the Unit of Work.
  • Enum Constant Details

    • NOT_STARTED

      public static final UnitOfWork.Phase NOT_STARTED
      Indicates that the unit of work has been created but has not been registered with the CurrentUnitOfWork yet.
    • STARTED

      public static final UnitOfWork.Phase STARTED
      Indicates that the Unit of Work has been registered with the CurrentUnitOfWork but has not been committed, because its Message has not been processed yet.
    • PREPARE_COMMIT

      public static final UnitOfWork.Phase PREPARE_COMMIT
      Indicates that the Unit of Work is preparing its commit. This means that UnitOfWork.commit() has been invoked on the Unit of Work, indicating that the Message UnitOfWork.getMessage() of the Unit of Work has been processed.

      All handlers registered to be notified before commit UnitOfWork.onPrepareCommit(java.util.function.Consumer<org.axonframework.messaging.unitofwork.UnitOfWork<T>>) will be invoked. If no exception is raised by any of the handlers the Unit of Work will go into the COMMIT phase, otherwise it will be rolled back.

    • COMMIT

      public static final UnitOfWork.Phase COMMIT
      Indicates that the Unit of Work has been committed and is passed the PREPARE_COMMIT phase.
    • ROLLBACK

      public static final UnitOfWork.Phase ROLLBACK
      Indicates that the Unit of Work is being rolled back. Generally this is because an exception was raised while processing the message or while the Unit of Work was being committed.
    • AFTER_COMMIT

      public static final UnitOfWork.Phase AFTER_COMMIT
      Indicates that the Unit of Work is after a successful commit. In this phase the Unit of Work cannot be rolled back anymore.
    • CLEANUP

      public static final UnitOfWork.Phase CLEANUP
      Indicates that the Unit of Work is after a successful commit or after a rollback. Any resources tied to this Unit of Work should be released.
    • CLOSED

      public static final UnitOfWork.Phase CLOSED
      Indicates that the Unit of Work is at the end of its life cycle. This phase is final.
  • Method Details

    • values

      public static UnitOfWork.Phase[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static UnitOfWork.Phase valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • isStarted

      public boolean isStarted()
      Check if a Unit of Work in this phase has been started, i.e. is registered with the CurrentUnitOfWork.
      Returns:
      true if the Unit of Work is started when in this phase, false otherwise
    • isReverseCallbackOrder

      public boolean isReverseCallbackOrder()
      Check whether registered handlers for this phase should be invoked in the order of registration (first registered handler is invoked first) or in the reverse order of registration (last registered handler is invoked first).
      Returns:
      true if the order of invoking handlers in this phase should be in the reverse order of registration, false otherwise.
    • isSuppressHandlerErrors

      public boolean isSuppressHandlerErrors()
      Indicates whether the handlers triggered for this phase should have their exceptions suppressed. This is the case for phases where cleanup or post-error processing is done. Exceptions in those phases should not trigger exceptions, but to a best-effort attempt to clean up.
      Returns:
      true when errors should be suppressed, otherwise false
    • isBefore

      public boolean isBefore(UnitOfWork.Phase phase)
      Check if this Phase comes before given other phase.
      Parameters:
      phase - The other Phase
      Returns:
      true if this comes before the given phase, false otherwise.
    • isAfter

      public boolean isAfter(UnitOfWork.Phase phase)
      Check if this Phase comes after given other phase.
      Parameters:
      phase - The other Phase
      Returns:
      true if this comes after the given phase, false otherwise.