Understanding SQS message receive amount
Asked Answered
G

1

10

I have a queue which is supposed to receive the messages sent by a lambda function. This function is supposed to send each different message once only. However, I saw a scary amount of receive count on the console: enter image description here

Since I cannot find any explanation about receive count in the plain English, I need to consult StackOverflow Community. I have 2 theories to verify:

  1. There are actually not so many messages and the reason why "receive count" is that high is simply because I polled the messages for a looooong time so the messages were captured more than once;
  2. the function that sends the messages to the queue is SQS-triggered, those messages might be processed by multiple processors. Though I set VisibilityTimeout already, are the messages which are processed going to be deleted? If they aren't remained, there are no reasons for them to be caught and processed for a second time.

Any debugging suggestion will be appreciated!!

Gesticulation answered 11/8, 2022 at 19:44 Comment(1)
It's showing the number of times that a message has been received. If the component that's received the message doesn't delete the message from the queue when it's done processing it, the message will be available to be received again once the visibility timeout has passed up until the message is cleaned up from the queue based off the message retention period.Editorial
S
15

So, receive count is basically the amount of times the lambda (or any other consumer) has received the message. It can be that a consumer receives a message more than once (this is by design, and you should handle that in your logic).

That being said, the receive count also increases if your lambda fails to process the message (or even hits the execution limits). The default is 3 times, so if something with your lambda is wrong, you will have at least 3 receives per message.

Also, when you are polling the message, via the AWS console, you are basically increasing the receive count.

Shaylynn answered 12/8, 2022 at 12:2 Comment(1)
Can we check the reciveCount of a message (how many time message already delivered to) from a lambda / service primarily C#?Heterothallic

© 2022 - 2024 — McMap. All rights reserved.