Class AggregateBasedConsistencyMarker
java.lang.Object
org.axonframework.eventsourcing.eventstore.AbstractConsistencyMarker<AggregateBasedConsistencyMarker>
org.axonframework.eventsourcing.eventstore.AggregateBasedConsistencyMarker
- All Implemented Interfaces:
ConsistencyMarker
public class AggregateBasedConsistencyMarker
extends AbstractConsistencyMarker<AggregateBasedConsistencyMarker>
ConsistencyMarker implementation that keeps track of a position per aggregate identifier. A single
AggregateBasedConsistencyMarker can track the positions of multiple Aggregates.- Since:
- 5.0.0
- Author:
- Allard Buijze
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal classHelper class that tracks the sequence of events for different aggregates and manages the consistency marker for the aggregates. -
Field Summary
Fields inherited from interface org.axonframework.eventsourcing.eventstore.ConsistencyMarker
INFINITY, ORIGIN, RESOURCE_KEY -
Constructor Summary
ConstructorsConstructorDescriptionAggregateBasedConsistencyMarker(String aggregateIdentifier, long sequenceNumber) Construct a new consistency marker for givenaggregateIdentifierandsequenceNumber. -
Method Summary
Modifier and TypeMethodDescriptionCreate anAggregateBasedConsistencyMarker.AggregateSequencer, initialized with values from this marker, which can increment and provide sequence numbers of multiple aggregates, and integrate the results into a newAggregateBasedConsistencyMarker.Calculate the lower bound ofthismarker and givenothermarker.Calculate the upper bound ofthismarker and givenothermarker.booleanfrom(AppendCondition appendCondition) Constructs anAggregateBasedConsistencyMarkerbased of the givenappendCondition.inthashCode()position()Reduces this consistency marker to a single position if possible.toString()Methods inherited from class org.axonframework.eventsourcing.eventstore.AbstractConsistencyMarker
lowerBound, upperBound
-
Constructor Details
-
AggregateBasedConsistencyMarker
Construct a new consistency marker for givenaggregateIdentifierandsequenceNumber.- Parameters:
aggregateIdentifier- The identifier of the aggregate to contain in the marker.sequenceNumber- The sequence number of the last seen event of the aggregate.
-
-
Method Details
-
from
Constructs anAggregateBasedConsistencyMarkerbased of the givenappendCondition. If the consistency marker of the givenappendConditionis not an instance ofAggregateBasedConsistencyMarker, it will attempt to create an instance that respects the condition. If such conversion is not possible, the method throws anIllegalArgumentException.- Parameters:
appendCondition- The condition to create anAggregateBasedConsistencyMarkerfor- Returns:
- an
AggregateBasedConsistencyMarkerthat represents the givenappendCondition - Throws:
IllegalArgumentException- when the consistency marker of given append condition cannot be safely converted to anAggregateBasedConsistencyMarker.
-
doLowerBound
Description copied from class:AbstractConsistencyMarkerCalculate the lower bound ofthismarker and givenothermarker. The result must represent the lowest of the given markers. This may either be on ofthisor theothermarker, or any other that represents their lower bound.- Specified by:
doLowerBoundin classAbstractConsistencyMarker<AggregateBasedConsistencyMarker>- Parameters:
other- The other marker.- Returns:
- A marker representing the lower bound of this and the other marker.
-
doUpperBound
Description copied from class:AbstractConsistencyMarkerCalculate the upper bound ofthismarker and givenothermarker. The result must represent the highest of the given markers. This may either be on ofthisor theothermarker, or any other that represents their upper bound.- Specified by:
doUpperBoundin classAbstractConsistencyMarker<AggregateBasedConsistencyMarker>- Parameters:
other- The other marker.- Returns:
- A marker representing the upper bound of this and the other marker.
-
position
Description copied from interface:ConsistencyMarkerReduces this consistency marker to a single position if possible.- Returns:
- a
Position, nevernull
-
equals
-
hashCode
public int hashCode() -
toString
-
createSequencer
Create anAggregateBasedConsistencyMarker.AggregateSequencer, initialized with values from this marker, which can increment and provide sequence numbers of multiple aggregates, and integrate the results into a newAggregateBasedConsistencyMarker.- Returns:
- an
AggregateBasedConsistencyMarker.AggregateSequencerinitialized with values from this marker, nevernull
-