Class TokenStoringProgressStrategy
java.lang.Object
org.axonframework.messaging.eventhandling.processing.streaming.progress.TokenStoringProgressStrategy
- All Implemented Interfaces:
SegmentProgressStrategy
@Internal
public final class TokenStoringProgressStrategy
extends Object
implements SegmentProgressStrategy
Default
SegmentProgressStrategy: persists the batch-end token (SegmentProgressContext.lastConsumedToken())
on every commit, so the stored TrackingToken advances to the position consumed by each batch. This is the
behaviour to expect when no advanced progress handling is configured.
It schedules no out-of-band work (hasPendingWork() is always false) and acts only within the batch
and idle cycles it is invoked on. On an idle cycle onBatchCommit(ProcessingContext) is still invoked on the
claim-extension beat, so a token advanced purely by ignored events is caught up then.
Internal API. This class is marked Internal: it is the default implementation of the progress seam and
not stable end-user API.
- Since:
- 5.3.0
- Author:
- Allard Buijze
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs aTokenStoringProgressStrategybound to the givencontext. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates whether the strategy has out-of-band work that requires a worker cycle even when no events are queued (for example, an asynchronous checkpoint request recorded between cycles).onBatchCommit(ProcessingContext processingContext) Decides the safeTrackingTokenfor the current cycle and persists it throughSegmentProgressContext.persistProgress(TrackingToken, ProcessingContext), withincontext.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.messaging.eventhandling.processing.streaming.progress.SegmentProgressStrategy
contributeBatchResources, onAbort, onSegmentClaimed, onSegmentReleased
-
Constructor Details
-
TokenStoringProgressStrategy
Constructs aTokenStoringProgressStrategybound to the givencontext.- Parameters:
context- the progress context to persist progress through
-
-
Method Details
-
onBatchCommit
Description copied from interface:SegmentProgressStrategyDecides the safeTrackingTokenfor the current cycle and persists it throughSegmentProgressContext.persistProgress(TrackingToken, ProcessingContext), withincontext. Invoked on the commit of a non-empty batch (so the store commits atomically with the batch), and on an idle cycle to store progress that advanced without a handled batch. May store nothing (for example, when nothing advanced or no persistence is due yet).- Specified by:
onBatchCommitin interfaceSegmentProgressStrategy- Parameters:
processingContext- the processing context whose transaction the store participates in- Returns:
- a
CompletableFuturecompleting when the cycle's persistence (if any) has been applied
-
hasPendingWork
public boolean hasPendingWork()Description copied from interface:SegmentProgressStrategyIndicates whether the strategy has out-of-band work that requires a worker cycle even when no events are queued (for example, an asynchronous checkpoint request recorded between cycles). Drives the post-cycle reschedule and lets an idle segment run a commit cycle. Strategies that act only within their batches never schedule out-of-band and returnfalse; this is deliberately not a throttle for idle catch-up stores, which are driven on the claim-extension beat.- Specified by:
hasPendingWorkin interfaceSegmentProgressStrategy- Returns:
trueif a worker cycle is needed for out-of-band work,falseotherwise
-