I want to setup a backoff strategy for sqs in Spring application. What I did is :
@Bean
public ConnectionFactory sqsConnectionFactory() {
PredefinedBackoffStrategies.ExponentialBackoffStrategy backoffStrategy = new PredefinedBackoffStrategies.ExponentialBackoffStrategy(3, 27);
RetryPolicy retryPolicy = new RetryPolicy(PredefinedRetryPolicies.DEFAULT_RETRY_CONDITION, backoffStrategy, PredefinedRetryPolicies.DEFAULT_MAX_ERROR_RETRY, false);
return SQSConnectionFactory.builder()
.withRegion(Region.getRegion(Regions.fromName(region)))
.withAWSCredentialsProvider(new DefaultAWSCredentialsProviderChain())
.withClientConfiguration(new ClientConfiguration().withRetryPolicy(retryPolicy))
.build();
}
, but it has no effect. I read from SQS queue from simple @JmsListener
method. In this method there is call to other api. This api returns me 404 error. Then there is a retry, but it's an instant retry. Why is that, how to properly configure this with exponential back off strategy ? It's retrying but not with exponential delay time.