问题
I'm trying send individual SQS messages with a delay. Using https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-send-message-with-timer.html to test message delays, I'm not seeing any delay.
If I set a delay on the queue, that delay is honoured, however not for individual messages. I'm doing the following (all from the AWS console):
- Open the SQS console and right click on my test queue - verify that there the delay value for the queue is 0.
- Right click on the test queue and click 'Send a Message'
- Add a message body
- Set 'Delay delivery of this message by' to 30 seconds
- Click Send Message.
- Receive a confirmation stating 'Your message has been sent and will be ready to be received in 30 seconds.'
However when I check CloudWatch I can see that the message was delivered almost immediately. I'm I misunderstanding something, or have I missed something in the configuration?
回答1:
My testing shows that messages sent to an SQS queue which a Lambda function is using as a trigger will immediately trigger the Lambda function, even if a Delay setting is provided.
See: amazon sqs - How do I return a message back to SQS from lambda trigger - Stack Overflow
来源:https://stackoverflow.com/questions/58221589/sqs-message-delay-not-working-as-expected