Class ExponentialBackOffIntervalRetryScheduler
java.lang.Object
org.axonframework.commandhandling.gateway.AbstractRetryScheduler
org.axonframework.commandhandling.gateway.ExponentialBackOffIntervalRetryScheduler
- All Implemented Interfaces:
RetryScheduler
A RetryScheduler that uses a backoff strategy, retrying commands at increasing 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:
- 4.2
- Author:
- Bert Laverman
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class to instantiate anExponentialBackOffIntervalRetryScheduler. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInstantiate anExponentialBackOffIntervalRetryScheduler. the settings are copied from theExponentialBackOffIntervalRetryScheduler.Builderand validated. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Instantiate a Builder to be able to create aExponentialBackOffIntervalRetryScheduler.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
-
ExponentialBackOffIntervalRetryScheduler
protected ExponentialBackOffIntervalRetryScheduler(ExponentialBackOffIntervalRetryScheduler.Builder builder) Instantiate anExponentialBackOffIntervalRetryScheduler. the settings are copied from theExponentialBackOffIntervalRetryScheduler.Builderand validated.- Parameters:
builder-
-
-
Method Details
-
builder
Instantiate a Builder to be able to create aExponentialBackOffIntervalRetryScheduler.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
ExponentialBackOffIntervalRetryScheduler
-
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.
-