Unexpected value for Approximate Number Of Messages Not Visible
Unexpected value for Approximate Number Of Messages Not Visible
You may find that the ChangeMessageVisibility feature combined with the ApproximateNumberOfMessagesNotVisible attribute in Scaleway Queues does not behave as you expect.
When using ChangeMessageVisibility to set a VisibilityTimeout of 0, you force the queue to requeue the message in question, making it immediately available for other consumers to process. You imagine this should have a direct effect on the ApproximateNumberOfMessagesNotVisible attribute, but the value for that attribute does not change.
Cause
The cause of the problem is that the underlying message broker used by Scaleway Queues does not provide the necessary information to set an absolutely correct value for the ApproximateNumberOfMessagesNotVisible attribute. As a result, this attribute does not accurately reflect the number of messages that are not visible.
Solution
We can confirm that the ChangeMessageVisibility feature works properly, and the name of the ApproximateNumberOfMessagesNotVisible attribute may be misleading. That said, the attribute name contains the qualifier "Approximate" for a reason, and as such its value may not always reflect the actual number of messages that are not visible.