I created a standard queue with the following specs:
I have a lambda consumer that receives the messages. From the documentation, it says that you need to explicitly delete the message in the consumer once it is processed (at least to guarantee that it is removed). However, it seems that the messages get deleted on their own regardless of them being deleted in the consumer or if the consumer returns an unsuccessful status code. The only way I've seen a message return to the queue is when I raise some sort of runtime error in the consumer.
Question: What is a proper error message to return to the consumer so that it knows to not delete the message?
The Lambda service communicates with the queue, applying success and failure conditions to your function's return value. In a nutshell, the Lambda service interprets:
You can optionally manually delete messages from the queue with a DeleteMessage
SDK call, although there is no obligation to do so. Manual deletion might make sense if your service is not idempotent and you really need to avoid double-processing.