Class PollingStrategies
java.lang.Object
software.amazon.lambda.durable.retry.PollingStrategies
Factory class for creating common polling strategies.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classPreset polling strategies for common use cases. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PollingStrategyexponentialBackoff(Duration baseInterval, double backoffRate, JitterStrategy jitter, Duration maxInterval) Creates an exponential backoff polling strategy.static PollingStrategyfixedDelay(Duration interval) Creates a fixed-delay polling strategy that uses the same interval for every attempt.
-
Constructor Details
-
PollingStrategies
public PollingStrategies()
-
-
Method Details
-
exponentialBackoff
public static PollingStrategy exponentialBackoff(Duration baseInterval, double backoffRate, JitterStrategy jitter, Duration maxInterval) Creates an exponential backoff polling strategy.The delay calculation follows the formula: delay = jitter(baseInterval × backoffRate^attempt)
- Parameters:
baseInterval- Base delay before first pollbackoffRate- Multiplier for exponential backoff (must be positive)jitter- Jitter strategy to apply to delaysmaxInterval- Maximum delay between polls- Returns:
- PollingStrategy implementing exponential backoff with jitter
-
fixedDelay
Creates a fixed-delay polling strategy that uses the same interval for every attempt.- Parameters:
interval- Fixed delay between polls- Returns:
- PollingStrategy with fixed delay
-