Class IntervalRetryScheduler
java.lang.Object
org.axonframework.commandhandling.gateway.AbstractRetryScheduler
org.axonframework.commandhandling.gateway.IntervalRetryScheduler
- All Implemented Interfaces:
RetryScheduler
RetryScheduler implementation that retries commands at regular intervals when they fail because of an exception that
is not explicitly non-transient. Checked exceptions are considered non-transient and will not result in a retry.
- Since:
- 2.0
- Author:
- Allard Buijze
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class to instantiate aIntervalRetryScheduler. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInstantiate aIntervalRetrySchedulerbased on the fields contained in theIntervalRetryScheduler.Builder. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Instantiate a Builder to be able to create aIntervalRetryScheduler.protected longcomputeRetryInterval(CommandMessage commandMessage, RuntimeException lastFailure, List<Class<? extends Throwable>[]> failures) Compute the amount of milliseconds delay until the next retry, given the information passed.Methods inherited from class org.axonframework.commandhandling.gateway.AbstractRetryScheduler
isExplicitlyNonTransient, scheduleRetry, scheduleRetry
-
Constructor Details
-
IntervalRetryScheduler
Instantiate aIntervalRetrySchedulerbased on the fields contained in theIntervalRetryScheduler.Builder.Will assert that the
retryIntervalandmaxRetryCountare positive numbers, and that theScheduledExecutorServiceis notnull. If any of these does not hold, anAxonConfigurationExceptionwill be thrown.- Parameters:
builder- theIntervalRetryScheduler.Builderused to instantiate aIntervalRetrySchedulerinstance
-
-
Method Details
-
computeRetryInterval
protected long computeRetryInterval(CommandMessage commandMessage, RuntimeException lastFailure, List<Class<? extends Throwable>[]> failures) Description copied from class:AbstractRetrySchedulerCompute the amount of milliseconds delay until the next retry, given the information passed.- Specified by:
computeRetryIntervalin classAbstractRetryScheduler- Parameters:
commandMessage- the command that was sent (and failed).lastFailure- the last failure that caused this retry scheduler to be called.failures- aListof all failures up to now.- Returns:
- the number of milliseconds to wait until retrying.
-
builder
Instantiate a Builder to be able to create aIntervalRetryScheduler.The default for
maxRetryCountis set to a single retry, thebackoffFactordefaults to 100ms and thenonTransientFailurePredicatedefaults toAxonNonTransientExceptionClassesPredicate. TheScheduledExecutorServiceis a hard requirement and as such should be provided.- Returns:
- a Builder to be able to create a
IntervalRetryScheduler
-