SqsClient

interface SqsClient : SdkClient

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

Additional information

Properties

Link copied to clipboard
abstract override val config: SqsClient.Config

SqsClient's configuration

Functions

Link copied to clipboard

Adds a permission to a queue for a specific principal. This allows sharing access to the queue.

Link copied to clipboard

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.

Link copied to clipboard

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.

Link copied to clipboard

Changes the visibility timeout of multiple messages. This is a batch version of <a>ChangeMessageVisibility</a>. The result of the action on each message is reported individually in the response. You can send up to 10 <a>ChangeMessageVisibility</a> requests with each ChangeMessageVisibilityBatch action.

Link copied to clipboard
abstract suspend fun createQueue(input: CreateQueueRequest): CreateQueueResponse

Creates a new standard or FIFO queue. You can pass one or more attributes in the request. Keep the following in mind:

Link copied to clipboard

Deletes the specified message from the specified queue. To select the message to delete, use the ReceiptHandle of the message (not the MessageId which 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.

Link copied to clipboard

Deletes up to ten messages from the specified queue. This is a batch version of <a>DeleteMessage</a>. The result of the action on each message is reported individually in the response.

Link copied to clipboard
abstract suspend fun deleteQueue(input: DeleteQueueRequest): DeleteQueueResponse

Deletes the queue specified by the QueueUrl, regardless of the queue's contents.

Link copied to clipboard

Gets attributes for the specified queue.

Link copied to clipboard
abstract suspend fun getQueueUrl(input: GetQueueUrlRequest): GetQueueUrlResponse

The GetQueueUrl API 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.

Link copied to clipboard

Returns a list of your queues that have the RedrivePolicy queue attribute configured with a dead-letter queue.

Link copied to clipboard

Gets the most recent message movement tasks (up to 10) under a specific source queue.

Link copied to clipboard
abstract suspend fun listQueues(input: ListQueuesRequest = ListQueuesRequest { }): ListQueuesResponse

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 QueueNamePrefix parameter, only queues with a name that begins with the specified value are returned.

Link copied to clipboard

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.

Link copied to clipboard
abstract suspend fun purgeQueue(input: PurgeQueueRequest): PurgeQueueResponse

Deletes available messages in a queue (including in-flight messages) specified by the QueueURL parameter.

Link copied to clipboard

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.

Link copied to clipboard

Revokes any permissions in the queue policy that matches the specified Label parameter.

Link copied to clipboard
abstract suspend fun sendMessage(input: SendMessageRequest): SendMessageResponse

Delivers a message to the specified queue.

Link copied to clipboard

You can use SendMessageBatch to 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 of <a>SendMessage</a>. For a FIFO queue, multiple messages within a single batch are enqueued in the order they are sent.

Link copied to clipboard

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 MessageRetentionPeriod attribute can take up to 15 minutes and will impact existing messages in the queue potentially causing them to be expired and deleted if the MessageRetentionPeriod is reduced below the age of existing messages.

Link copied to clipboard

Starts an asynchronous task to move messages from a specified source queue to a specified destination queue.

Link copied to clipboard
abstract suspend fun tagQueue(input: TagQueueRequest): TagQueueResponse

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.

Link copied to clipboard
abstract suspend fun untagQueue(input: UntagQueueRequest): UntagQueueResponse

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.

Inherited functions

Link copied to clipboard
inline suspend fun SqsClient.addPermission(crossinline block: AddPermissionRequest.Builder.() -> Unit): AddPermissionResponse

Adds a permission to a queue for a specific principal. This allows sharing access to the queue.

Link copied to clipboard

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.

Link copied to clipboard

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.

Link copied to clipboard

Changes the visibility timeout of multiple messages. This is a batch version of <a>ChangeMessageVisibility</a>. The result of the action on each message is reported individually in the response. You can send up to 10 <a>ChangeMessageVisibility</a> requests with each ChangeMessageVisibilityBatch action.

Link copied to clipboard
expect abstract fun close()
Link copied to clipboard
inline suspend fun SqsClient.createQueue(crossinline block: CreateQueueRequest.Builder.() -> Unit): CreateQueueResponse

Creates a new standard or FIFO queue. You can pass one or more attributes in the request. Keep the following in mind:

Link copied to clipboard
inline suspend fun SqsClient.deleteMessage(crossinline block: DeleteMessageRequest.Builder.() -> Unit): DeleteMessageResponse

Deletes the specified message from the specified queue. To select the message to delete, use the ReceiptHandle of the message (not the MessageId which 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.

Link copied to clipboard

Deletes up to ten messages from the specified queue. This is a batch version of <a>DeleteMessage</a>. The result of the action on each message is reported individually in the response.

Link copied to clipboard
inline suspend fun SqsClient.deleteQueue(crossinline block: DeleteQueueRequest.Builder.() -> Unit): DeleteQueueResponse

Deletes the queue specified by the QueueUrl, regardless of the queue's contents.

Link copied to clipboard

Gets attributes for the specified queue.

Link copied to clipboard
inline suspend fun SqsClient.getQueueUrl(crossinline block: GetQueueUrlRequest.Builder.() -> Unit): GetQueueUrlResponse

The GetQueueUrl API 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.

Link copied to clipboard

Returns a list of your queues that have the RedrivePolicy queue attribute configured with a dead-letter queue.

Link copied to clipboard

Gets the most recent message movement tasks (up to 10) under a specific source queue.

Link copied to clipboard
inline suspend fun SqsClient.listQueues(crossinline block: ListQueuesRequest.Builder.() -> Unit): ListQueuesResponse

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 QueueNamePrefix parameter, only queues with a name that begins with the specified value are returned.

Link copied to clipboard
fun SqsClient.listQueuesPaginated(initialRequest: ListQueuesRequest = ListQueuesRequest { }): Flow<ListQueuesResponse>

Paginate over ListQueuesResponse results.

Link copied to clipboard
inline suspend fun SqsClient.listQueueTags(crossinline block: ListQueueTagsRequest.Builder.() -> Unit): ListQueueTagsResponse

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.

Link copied to clipboard
inline suspend fun SqsClient.purgeQueue(crossinline block: PurgeQueueRequest.Builder.() -> Unit): PurgeQueueResponse

Deletes available messages in a queue (including in-flight messages) specified by the QueueURL parameter.

Link copied to clipboard

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.

Link copied to clipboard

Revokes any permissions in the queue policy that matches the specified Label parameter.

Link copied to clipboard
inline suspend fun SqsClient.sendMessage(crossinline block: SendMessageRequest.Builder.() -> Unit): SendMessageResponse

Delivers a message to the specified queue.

Link copied to clipboard

You can use SendMessageBatch to 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 of <a>SendMessage</a>. For a FIFO queue, multiple messages within a single batch are enqueued in the order they are sent.

Link copied to clipboard

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 MessageRetentionPeriod attribute can take up to 15 minutes and will impact existing messages in the queue potentially causing them to be expired and deleted if the MessageRetentionPeriod is reduced below the age of existing messages.

Link copied to clipboard

Starts an asynchronous task to move messages from a specified source queue to a specified destination queue.

Link copied to clipboard
inline suspend fun SqsClient.tagQueue(crossinline block: TagQueueRequest.Builder.() -> Unit): TagQueueResponse

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.

Link copied to clipboard
inline suspend fun SqsClient.untagQueue(crossinline block: UntagQueueRequest.Builder.() -> Unit): UntagQueueResponse

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.

Link copied to clipboard

Create a copy of the client with one or more configuration values overridden. This method allows the caller to perform scoped config overrides for one or more client operations.