Class ConflictingAggregateVersionException

All Implemented Interfaces:
Serializable

public class ConflictingAggregateVersionException extends ConflictingModificationException
Exception indicating that the (actual) version of a loaded aggregate did not match the given expected version number. This typically means that the aggregate has been modified by another thread between the moment data was queried, and the command modifying the aggregate was handled.
Since:
0.6
Author:
Allard Buijze
See Also:
  • Constructor Details

    • ConflictingAggregateVersionException

      public ConflictingAggregateVersionException(String aggregateIdentifier, long expectedVersion, long actualVersion)
      Initializes the exception using the given message.
      Parameters:
      aggregateIdentifier - The identifier of the aggregate which version was not as expected
      expectedVersion - The version expected by the component loading the aggregate
      actualVersion - The actual version of the aggregate
    • ConflictingAggregateVersionException

      public ConflictingAggregateVersionException(String aggregateIdentifier, long expectedVersion, long actualVersion, Throwable cause)
      Initializes the exception using the given message and cause.
      Parameters:
      aggregateIdentifier - The identifier of the aggregate which version was not as expected
      expectedVersion - The version expected by the component loading the aggregate
      actualVersion - The actual version of the aggregate
      cause - The underlying cause of the exception
  • Method Details

    • getAggregateIdentifier

      public Object getAggregateIdentifier()
      Returns the identifier of the aggregate which version is not as expected.
      Returns:
      the identifier of the aggregate which version is not as expected
    • getExpectedVersion

      public long getExpectedVersion()
      Returns the version expected by the component loading the aggregate.
      Returns:
      the version expected by the component loading the aggregate
    • getActualVersion

      public long getActualVersion()
      Returns the actual version of the aggregate, as loaded by the repository.
      Returns:
      the actual version of the aggregate