As per documentation , The visibility timeout begins when Amazon SQS returns a message. During this time, the consumer processes and deletes the message. However, if the consumer fails before deleting the message and your system doesn't call the DeleteMessage action for that message before the visibility timeout expires, the message becomes visible.
While using spring boot 3 @SqsListener
, the default acknowledgement mode is ON_SUCCESS as documentation.
Now if the acknowledgement mode is ON_SUCCESS
and visibility timeout is 30 minutes but the processing of message fails at 15 minutes. Will the message be immediately visible after failure or SQS will wait 30 minutes to make messages visible to other consumers.
The message will continue to be hidden to other consumers until the visibility timeout expires.
You can however inject the instance of Visibility into your method and change the visibility to 0 in your exception handler. This will make the message visible to other consumers immediately.