问题
I am writing an application in Lambda that is invoked by SQS messages.
I would like to be able to tell the difference between an invocation resulting from a "duplicate" message vs one resulting from a previous failure/retry (both SQS and Lambda will retry in case of failure).
Is the messageId the same for duplicate messages, or just the body? If they are different I might be able to track a messageId against a key from the body to identity duplicates.
TIA.
回答1:
Ideally, you would want to store the message id some kind of database once you successfully process the message. And the next time around if you get a message with a message id already present in your store, you will know that this has been successfully processed.
来源:https://stackoverflow.com/questions/51937217/sqs-distinguish-between-duplicate-and-failed-retry-messages