AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
WaitTimeSecondsparameter. For more information, see Amazon SQS Long Poll in the Amazon SQS Developer Guide.
Short poll is the default behavior where a weighted random set of machines is sampled on a
ReceiveMessagecall. This means only the messages on the sampled machines are returned. If the number of messages in the queue is small (less than 1000), it is likely you will get fewer messages than you requested per
ReceiveMessagecall. If the number of messages in the queue is extremely small, you might not receive any messages in a particular
ReceiveMessageresponse; in which case you should repeat the request.
For each message returned, the response includes the following:
Message body
MD5 digest of the message body. For information about MD5, go to http://www.faqs.org/rfcs/rfc1321.html.
Message ID you received when you sent the message to the queue.
Receipt handle.
Message attributes.
MD5 digest of the message attributes.
The receipt handle is the identifier you must provide when deleting the message. For more information, see Queue and Message Identifiers in the Amazon SQS Developer Guide.
You can provide the
VisibilityTimeoutparameter in your request, which will be applied to the messages that Amazon SQS returns in the response. If you do not include the parameter, the overall visibility timeout for the queue is used for the returned messages. For more information, see Visibility Timeout in the Amazon SQS Developer Guide.
Going forward, new attributes might be added. If you are writing code that calls this action, we recommend that you structure your code so that it can handle new attributes gracefully.
Namespace: Amazon.SQS
Assembly: AWSSDK.dll
Version: 0.0.3.0
public abstract ReceiveMessageResponse ReceiveMessage( String queueUrl, Int32 maxNumberOfMessages )
The URL of the Amazon SQS queue to take action on.
The maximum number of messages to return. Amazon SQS never returns more messages than this value but may return fewer. Values can be from 1 to 10. Default is 1. All of the messages are not necessarily returned.
| Exception | Condition |
|---|---|
| OverLimitException | The action that you requested would violate a limit. For example, ReceiveMessage returns this error if the maximum number of messages inflight has already been reached. AddPermission returns this error if the maximum number of permissions for the queue has already been reached. |
.NET Framework:
Supported in: 4.5, 4.0, 3.5