Sqs class
Welcome to the Amazon SQS API Reference.
Amazon SQS is a reliable, highly-scalable hosted queue for storing messages as they travel between applications or microservices. Amazon SQS moves data between distributed application components and helps you decouple these components.
For information on the permissions you need to use this API, see Identity and access management in the Amazon SQS Developer Guide.
You can use Amazon Web Services SDKs to access Amazon SQS using your favorite programming language. The SDKs perform tasks such as the following automatically:
- Cryptographically sign your service requests
- Retry requests
- Handle error responses
- Amazon SQS Product Page
- Amazon SQS Developer Guide
- Amazon SQS in the Command Line Interface
- Amazon Web Services General Reference
Constructors
- Sqs({required String region, AwsClientCredentials? credentials, AwsClientCredentialsProvider? credentialsProvider, Client? client, String? endpointUrl})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addPermission(
{required List< String> awsAccountIds, required List<String> actions, required String label, required String queueUrl}) → Future<void> - Adds a permission to a queue for a specific principal. This allows sharing access to the queue.
-
cancelMessageMoveTask(
{required String taskHandle}) → Future< CancelMessageMoveTaskResult> - Cancels a specified message movement task. A message movement can only be cancelled when the current status is RUNNING. Cancelling a message movement task does not revert the messages that have already been moved. It can only stop the messages that have not been moved yet.
-
changeMessageVisibility(
{required String queueUrl, required String receiptHandle, required int visibilityTimeout}) → Future< void> - Changes the visibility timeout of a specified message in a queue to a new value. The default visibility timeout for a message is 30 seconds. The minimum is 0 seconds. The maximum is 12 hours. For more information, see Visibility Timeout in the Amazon SQS Developer Guide.
-
changeMessageVisibilityBatch(
{required List< ChangeMessageVisibilityBatchRequestEntry> entries, required String queueUrl}) → Future<ChangeMessageVisibilityBatchResult> -
Changes the visibility timeout of multiple messages. This is a batch
version of
ChangeMessageVisibility.The result of the action on each message is reported individually in the response. You can send up to 10ChangeMessageVisibilityrequests with eachChangeMessageVisibilityBatchaction. -
close(
) → void - Closes the internal HTTP client if none was provided at creation. If a client was passed as a constructor argument, this becomes a noop.
-
createQueue(
{required String queueName, Map< QueueAttributeName, String> ? attributes, Map<String, String> ? tags}) → Future<CreateQueueResult> - Creates a new standard or FIFO queue. You can pass one or more attributes in the request. Keep the following in mind:
-
deleteMessage(
{required String queueUrl, required String receiptHandle}) → Future< void> -
Deletes the specified message from the specified queue. To select the
message to delete, use the
ReceiptHandleof the message (not theMessageIdwhich you receive when you send the message). Amazon SQS can delete a message from a queue even if a visibility timeout setting causes the message to be locked by another consumer. Amazon SQS automatically deletes messages left in a queue longer than the retention period configured for the queue. -
deleteMessageBatch(
{required List< DeleteMessageBatchRequestEntry> entries, required String queueUrl}) → Future<DeleteMessageBatchResult> -
Deletes up to ten messages from the specified queue. This is a batch
version of
DeleteMessage.The result of the action on each message is reported individually in the response. -
deleteQueue(
{required String queueUrl}) → Future< void> -
Deletes the queue specified by the
QueueUrl, regardless of the queue's contents. When you delete a queue, the deletion process takes up to 60 seconds. Requests you send involving that queue during the 60 seconds might succeed. For example, aSendMessagerequest might succeed, but after 60 seconds the queue and the message you sent no longer exist. -
getQueueAttributes(
{required String queueUrl, List< QueueAttributeName> ? attributeNames}) → Future<GetQueueAttributesResult> - Gets attributes for the specified queue.
-
getQueueUrl(
{required String queueName, String? queueOwnerAWSAccountId}) → Future< GetQueueUrlResult> -
The
GetQueueUrlAPI returns the URL of an existing Amazon SQS queue. This is useful when you know the queue's name but need to retrieve its URL for further operations. -
listDeadLetterSourceQueues(
{required String queueUrl, int? maxResults, String? nextToken}) → Future< ListDeadLetterSourceQueuesResult> -
Returns a list of your queues that have the
RedrivePolicyqueue attribute configured with a dead-letter queue. -
listMessageMoveTasks(
{required String sourceArn, int? maxResults}) → Future< ListMessageMoveTasksResult> - Gets the most recent message movement tasks (up to 10) under a specific source queue.
-
listQueues(
{int? maxResults, String? nextToken, String? queueNamePrefix}) → Future< ListQueuesResult> -
Returns a list of your queues in the current region. The response includes
a maximum of 1,000 results. If you specify a value for the optional
QueueNamePrefixparameter, only queues with a name that begins with the specified value are returned. -
listQueueTags(
{required String queueUrl}) → Future< ListQueueTagsResult> - List all cost allocation tags added to the specified Amazon SQS queue. For an overview, see Tagging Your Amazon SQS Queues in the Amazon SQS Developer Guide.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
purgeQueue(
{required String queueUrl}) → Future< void> -
Deletes available messages in a queue (including in-flight messages)
specified by the
QueueURLparameter. -
receiveMessage(
{required String queueUrl, List< QueueAttributeName> ? attributeNames, int? maxNumberOfMessages, List<String> ? messageAttributeNames, List<MessageSystemAttributeName> ? messageSystemAttributeNames, String? receiveRequestAttemptId, int? visibilityTimeout, int? waitTimeSeconds}) → Future<ReceiveMessageResult> -
Retrieves one or more messages (up to 10), from the specified queue. Using
the
WaitTimeSecondsparameter enables long-poll support. For more information, see Amazon SQS Long Polling in the Amazon SQS Developer Guide. -
removePermission(
{required String label, required String queueUrl}) → Future< void> -
Revokes any permissions in the queue policy that matches the specified
Labelparameter. -
sendMessage(
{required String messageBody, required String queueUrl, int? delaySeconds, Map< String, MessageAttributeValue> ? messageAttributes, String? messageDeduplicationId, String? messageGroupId, Map<MessageSystemAttributeNameForSends, MessageSystemAttributeValue> ? messageSystemAttributes}) → Future<SendMessageResult> - Delivers a message to the specified queue.
-
sendMessageBatch(
{required List< SendMessageBatchRequestEntry> entries, required String queueUrl}) → Future<SendMessageBatchResult> -
You can use
SendMessageBatchto send up to 10 messages to the specified queue by assigning either identical or different values to each message (or by not assigning values at all). This is a batch version ofSendMessage.For a FIFO queue, multiple messages within a single batch are enqueued in the order they are sent. -
setQueueAttributes(
{required Map< QueueAttributeName, String> attributes, required String queueUrl}) → Future<void> -
Sets the value of one or more queue attributes, like a policy. When you
change a queue's attributes, the change can take up to 60 seconds for most
of the attributes to propagate throughout the Amazon SQS system. Changes
made to the
MessageRetentionPeriodattribute can take up to 15 minutes and will impact existing messages in the queue potentially causing them to be expired and deleted if theMessageRetentionPeriodis reduced below the age of existing messages. -
startMessageMoveTask(
{required String sourceArn, String? destinationArn, int? maxNumberOfMessagesPerSecond}) → Future< StartMessageMoveTaskResult> - Starts an asynchronous task to move messages from a specified source queue to a specified destination queue.
-
tagQueue(
{required String queueUrl, required Map< String, String> tags}) → Future<void> - Add cost allocation tags to the specified Amazon SQS queue. For an overview, see Tagging Your Amazon SQS Queues in the Amazon SQS Developer Guide.
-
toString(
) → String -
A string representation of this object.
inherited
-
untagQueue(
{required String queueUrl, required List< String> tagKeys}) → Future<void> - Remove cost allocation tags from the specified Amazon SQS queue. For an overview, see Tagging Your Amazon SQS Queues in the Amazon SQS Developer Guide.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited