Spring Cloud AWS SQS Deletion Policy

Viewed 5298

We have a SQS listener, such as:

@MessageMapping("queueName")
void listen(String message) { ... }

This queue has redrive policy configured with an associated dead letter queue.

The problem is that the default Spring Cloud AWS implementation is deleting the message when polling it and wiring internally 3 retries for processing it, and failing afterwards.

I can see there is a SqsMessageDeletionPolicy enum with ALWAYS and ON_SUCCESS values, among others. I can't find in any documentation how can I change the QueueAttributes for that queue in order to change this behaviour.

Does anyone knows?

2 Answers

Accepted answer shows how to configure Deletion policy for single Queue,

If you want to set a Global deletion policy which will be used by all @SqsListener can be set by using a property: cloud.aws.sqs.handler.default-deletion-policy=ON_SUCCESS

Related