1

In the documentation, it says that ApproximateReceiveCount "Returns the number of times a message has been received across all queues but not deleted."

So by approximate in the attribute's name, does it mean it's possible that the count can be off by a little? What are the cases where it can be unaccurate?

I tried polling for the receive count but they seem accurate to me.

  • 1
    Yes, it's an approximation. This is a complex distributed system. It's probably accurate in the general case, as you've seen. It will potentially be wrong when SQS doesn't know for sure if a message was received, e.g. because of some unexpected network partition. – jarmod Dec 07 '22 at 21:17

1 Answers1

1

SQS default queues will guarantee "at least once" delivery of your messages (make sure consumer processing is idempotent).

Could deliver multiple times in case of internal problems (the doc reads "On rare occasions, one of the servers that stores a copy of a message might be unavailable when you receive or delete a message.").

This behavior allows high throughput / low latency / high availability but there has to be a compromise on consistency.

  • So in the rare occasion that it delivers the same message twice, they'll both be queued in the sqs, and the approximateReceiveNumber for both messages would be the same? If that's the case the approximateReceiveCount it would always be <= than the actual amount of times it was received, not more? – Tian Yue Dong Dec 07 '22 at 23:40