Skip to content

SQSClient.receive_message

rboto-sqs==0.4.0 · Service index · Types

Model summary (excerpt): 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 . Short poll is the default behavior where a weighted random set of machines is sampled on a ReceiveMessage call. Therefore, only the messages on the sampled machines are returned....

Install and imports

python -m pip install "rboto[sqs]==0.4.0"
from rboto import SQSClient
from collections.abc import Sequence
from rboto_sqs.types import (
    MessageSystemAttributeName,
    QueueAttributeName,
    ReceiveMessageOutput,
)

Signature

async def receive_message(
    *,
    queue_url: str,
    attribute_names: Sequence[QueueAttributeName] | None = None,
    message_system_attribute_names: Sequence[MessageSystemAttributeName] | None = None,
    message_attribute_names: Sequence[str] | None = None,
    max_number_of_messages: int | None = None,
    visibility_timeout: int | None = None,
    wait_time_seconds: int | None = None,
    receive_request_attempt_id: str | None = None,
) -> ReceiveMessageOutput: ...

Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.

Arguments

Argument Required Model notes (excerpt)
queue_url Yes The URL of the Amazon SQS queue from which messages are received. Queue URLs and names are case-sensitive.
attribute_names No This parameter has been discontinued but will be supported for backward compatibility. To provide attribute names, you are encouraged to use MessageSystemAttributeNames . A list of attributes that need to be returned along with each message. These attributes include: All – Returns all values. ApproximateFirstReceiveTimestamp – Returns the time the message was first received from the queue (...
message_system_attribute_names No A list of attributes that need to be returned along with each message. These attributes include: All – Returns all values. ApproximateFirstReceiveTimestamp – Returns the time the message was first received from the queue ( epoch time in milliseconds). ApproximateReceiveCount – Returns the number of times a message has been received across all queues but not deleted. AWSTraceHeader – Returns...
message_attribute_names No The name of the message attribute, where N is the index. The name can contain alphanumeric characters and the underscore ( _ ), hyphen ( - ), and period ( . ). The name is case-sensitive and must be unique among all attribute names for the message. The name must not start with AWS-reserved prefixes such as AWS. or Amazon. (or any casing variants). The name must not start or end with a period (...
max_number_of_messages No The maximum number of messages to return. Amazon SQS never returns more messages than this value (however, fewer messages might be returned). Valid values: 1 to 10. Default: 1.
visibility_timeout No The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request. If not specified, the default visibility timeout for the queue is used, which is 30 seconds. Understanding VisibilityTimeout : When a message is received from a queue, it becomes temporarily invisible to other consumers for the duration of the...
wait_time_seconds No The duration (in seconds) for which the call waits for a message to arrive in the queue before returning. If a message is available, the call returns sooner than WaitTimeSeconds . If no messages are available and the wait time expires, the call does not return a message list. If you are using the Java SDK, it returns a ReceiveMessageResponse object, which has a empty list instead of a Null...
receive_request_attempt_id No This parameter applies only to FIFO (first-in-first-out) queues. The token used for deduplication of ReceiveMessage calls. If a networking issue occurs after a ReceiveMessage action, and instead of a response you receive a generic error, it is possible to retry the same action with an identical ReceiveRequestAttemptId to retrieve the same set of messages, even if their visibility timeout has...

Output

ReceiveMessageOutput.

Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.

Field Type Presence References
messages list[MessageOutput] | None Always present MessageOutput

| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.

MessageSystemAttributeName, QueueAttributeName, ReceiveMessageOutput

Follow these links for nested inputs and outputs; recursive types link back to the same type page.

Pagination and streaming

No generated paginator for this operation.

No output stream.

Errors

Import from rboto_sqs.exceptions:

InvalidAddressError, InvalidSecurityError, KmsAccessDeniedError, KmsDisabledError, KmsInvalidKeyUsageError, KmsInvalidStateError, KmsNotFoundError, KmsOptInRequiredError, KmsThrottledError, OverLimitError, QueueDoesNotExistError, RequestThrottledError, UnsupportedOperationError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Service guide · Pinned model