- Le plus récent
- Le plus de votes
- La plupart des commentaires
Hello.
How many messages are in the SQS queue?
By default, ReceiveMessage retrieves 10 messages.
https://docs.aws.amazon.com/ja_jp/AWSSimpleQueueService/latest/APIReference/API_ReceiveMessage.html
Retrieves one or more messages (up to 10), from the specified queue. Using the WaitTimeSeconds parameter enables long-poll support. For more information, see Amazon SQS Long Polling in the Amazon SQS Developer Guide.
In the management console, you can adjust the "Maximum message count" as shown in the image below.
Additionally, as described in the AI automated response of re:Post Agent, using long polling can reduce the chance of missed messages.
https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-short-and-long-polling.html
This behavior is expected with Amazon SQS, especially when using short polling (which is the default method). When you poll for messages using short polling, Amazon SQS samples only a subset of its servers based on a weighted random distribution and returns messages from just those servers. This means a particular ReceiveMessage request might not return all your messages.
For standard queues with fewer than 1,000 messages, subsequent polling requests will eventually return all your messages. If you keep consuming from your queues, Amazon SQS will eventually sample all of its servers, and you'll receive all your messages.
To improve message retrieval, consider these options:
-
Use long polling instead of short polling by setting the
WaitTimeSecondsparameter to a value greater than 0 (up to 20 seconds). Long polling queries all servers for messages and waits until at least one message is available before sending a response, which eliminates the "missed messages" issue. -
For your SpringBoot application's SQSListener, ensure it's configured to use long polling.
-
Check your visibility timeout settings. If messages are being processed but not deleted, they'll become invisible for the duration of the visibility timeout and won't appear in subsequent polls until that timeout expires.
-
If you're using a FIFO queue (though you mentioned standard queue), be aware that message group ID can affect message retrieval patterns.
The behavior you're experiencing is part of SQS's distributed architecture design and not an error. Long polling is generally recommended as it reduces empty responses and ensures more consistent message retrieval.
Sources
Amazon SQS short and long polling - Amazon Simple Queue Service
Troubleshoot messages not returned for an Amazon SQS ReceiveMessage API call - Amazon Simple Queue Service
Unable to fetch data from SQS queue. | AWS re:Post
Contenus pertinents
- demandé il y a 8 mois
- demandé il y a 8 mois
- demandé il y a un mois
- demandé il y a 25 jours
- AWS OFFICIELA mis à jour il y a 4 ans
- AWS OFFICIELA mis à jour il y a 2 ans

@Ritu_Kobayashi How many messages are in the SQS queue? : at a time 1 I updated waitTimeSeconds to 20 secs and also tried wait polling , but still facing the same issue . Attaching the screen recording for your reference . https://drive.google.com/file/d/1cvuli6bbSydfGg2fDQ4eIlH3Q4dSIR0c/view?usp=sharing
Thanks