Class ConflictingAggregateVersionException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.axonframework.common.AxonException
org.axonframework.common.AxonNonTransientException
org.axonframework.modelling.command.ConflictingModificationException
org.axonframework.modelling.command.ConflictingAggregateVersionException
- All Implemented Interfaces:
Serializable
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 Summary
ConstructorsConstructorDescriptionConflictingAggregateVersionException(String aggregateIdentifier, long expectedVersion, long actualVersion) Initializes the exception using the givenmessage.ConflictingAggregateVersionException(String aggregateIdentifier, long expectedVersion, long actualVersion, Throwable cause) Initializes the exception using the givenmessageandcause. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the actual version of the aggregate, as loaded by the repository.Returns the identifier of the aggregate which version is not as expected.longReturns the version expected by the component loading the aggregate.Methods inherited from class org.axonframework.common.AxonNonTransientException
isCauseOfMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ConflictingAggregateVersionException
public ConflictingAggregateVersionException(String aggregateIdentifier, long expectedVersion, long actualVersion) Initializes the exception using the givenmessage.- Parameters:
aggregateIdentifier- The identifier of the aggregate which version was not as expectedexpectedVersion- The version expected by the component loading the aggregateactualVersion- The actual version of the aggregate
-
ConflictingAggregateVersionException
public ConflictingAggregateVersionException(String aggregateIdentifier, long expectedVersion, long actualVersion, Throwable cause) Initializes the exception using the givenmessageandcause.- Parameters:
aggregateIdentifier- The identifier of the aggregate which version was not as expectedexpectedVersion- The version expected by the component loading the aggregateactualVersion- The actual version of the aggregatecause- The underlying cause of the exception
-
-
Method Details
-
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
-