0

I am looking for a way to implement an exponential backoff strategy for failing messages on consumer. I am using SQS-JMS implementation and SQS implements JMS 1.1 specifications thus it is not possible to set a retry interval for a particular message. When consumer NACKed the queue, SQS callback scheduler automatically sets the visibility timeout to 0 and suddenly sends message to the customer again:

Setting the visibility timeout to 0

What I want is setting an exponential retry interval while resending the messages to the consumer. Previously I was using Active MQ and that was fair easy to setting a retry interval with connection factory configuration like :

    ActiveMQXAConnectionFactory connectionFactory = new ActiveMQXAConnectionFactory(url);
    connectionFactory.setClientID(CLIENT_ID);
    connectionFactory.setEnableSharedClientID(true);
    connectionFactory.setRetryInterval(1000);
    connectionFactory.setRetryIntervalMultiplier(1.5);
    connectionFactory.setMaxRetryInterval(60000);

I've checked similar questions but the most appropriate workaround is provided for Spring JMS implementation here

For the above workaround client is provided from interface AmazonSQSAsync extends AmazonSQS which is under package "com.amazonaws.services.sqs", but when I create the connection factory for JMS it uses interface SqsClient extends SdkClient which is under package "software.amazon.awssdk.services.sqs". So, this seems as another bottleneck for me.

Is there some points that I am missing or am I looking for an impossible solution ?

Thanks for any help.

mrtyvz
  • 11
  • 2

0 Answers0