We can set Retention time.
After this time, the message is automatically deleted.
It's very convenient.
So,
Why do we delete the SQS message using ReceiptHandle? What reason is it?
Because a message should generally only be processed once (excluding retries due to errors of course). The flow is: a service receives the message from the queue, processes it and then deletes it.
If it did not delete the message it would receive the exact same message during the next ReceiveMessage (after the VisibilityTimeout expires) call and work on the same message again, and again, and again, and again...
If you want a message to be processed multiple times, e.g. once by different consumers, you should use SNS and subscribe multiple queues to that SNS topic, one for each consumer and then each consumer consumes their respective queue and deletes a message from their queue if they are finished processing it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With