Reputation: 5132
Say, I have one SQS and a listener process listening to that queue. Say, there is one message, and while processing the message, say the process got killed automatically. Then, what will happen to this message? Will it again go to SQS or remain in flight? Or will it go to DLQ, if configured?
Upvotes: 0
Views: 570
Reputation: 25031
Your measages will have an “invisibility time-out”. During that time window they won’t be returned by subsequent request for messages.
Once the timeout expires, the message will be returned by another call.
Once you “ack” the message it won’t be processed again.
Generally SQS uses “at least once” semantics. Up to the maximum age of your queue it will reprocess messages until they are successfuly processed.
Absent something really crazy (where you keep failing the message for 14 days), it will ensure that your message is processed.
It does mean the code you run in response to a message needs to be idempotent (needs to run more than once with out changing the result).
But if you can do that, and you can respond to bugs in your code faster than 14 days, then you will be guranteed to have your message processed.
Does that make sense?
Upvotes: 2