Amazon Simple Queue Service (Amazon SQS) is a distributed queue messaging service introduced by Amazon.com in April of 2006. It supports programmatic sending of messages via web service applications as a way to communicate over the internet. The intent of SQS is to provide a highly scalable hosted message queue that resolves issues arising from the common producer-consumer problem or connectivity between producer and consumer.

Additional Info

Requires Mule Enterprise License

Yes  

Requires Entitlement

No  

Mule Version

3.6.0 or higher

Configs


Basic Configuration

<sqs:config>

Connection Management

Attributes

Name Java Type Description Default Value Required

name

String

The name of this configuration. With this name can be later referenced.

x 

accessKey

String

AWS access key

x 

secretKey

String

AWS secret key

x 

sessionToken

String

Temporary security credentials which are used to access the AWS resources.

 

tryDefaultAWSCredentialsProviderChain

boolean

Set it to true to try first to obtain credentials from AWS environment. See: http://docs.aws.amazon.com/java-sdk/latest/developer-guide/credentials.html#using-the-default-credential-provider-chain

 

defaultQueueName

String

Name of the queue to connect, if one does not exist the connector will automatically create one. Required if Queue URL has not been defined.

 

url

String

Queue URL takes priority over the Queue Name and is required if Queue Name has not been defined.

 

region

RegionEndpoint

Queue Region

 

protocol

Protocol

The optional communication protocol to use when sending requests to AWS. Communication over HTTPS is the default

HTTPS

 

proxyHost

String

The optional proxy port

 

proxyPort

Integer

The optional proxy port

 

proxyUsername

String

The optional proxy username

 

proxyPassword

String

The optional proxy password

 

proxyDomain

String

The optional proxy domain

 

proxyWorkstation

String

The optional proxy workstation

 

socketTimeout

Integer

The amount of time to wait (in milliseconds) for data to be transferred over an established, open connection before the connection is timed out. A value of 0 means infinity, and is not recommended.

50000

 

connectionTimeout

Integer

The amount of time to wait (in milliseconds) when initially establishing a connection before giving up and timing out. A value of 0 means infinity, and is not recommended.

50000

 


Role Configuration

<sqs:role-config>

Connection Management

Attributes

Name Java Type Description Default Value Required

name

String

The name of this configuration. With this name can be later referenced.

x 

accessKey

String

AWS access key

x 

secretKey

String

AWS secret key

x 

roleARN

String

The Role ARN allows you to cross account access without using security credentials.

x 

tryDefaultAWSCredentialsProviderChain

boolean

Set it to true to try first to obtain credentials from AWS environment. See: http://docs.aws.amazon.com/java-sdk/latest/developer-guide/credentials.html#using-the-default-credential-provider-chain

 

defaultQueueName

String

Name of the queue to connect, if one does not exist the connector will automatically create one. Required if Queue URL has not been defined.

 

url

String

Queue URL takes priority over the Queue Name and is required if Queue Name has not been defined.

 

region

RegionEndpoint

Queue Region

 

protocol

Protocol

The optional communication protocol to use when sending requests to AWS. Communication over HTTPS is the default

HTTPS

 

proxyHost

String

The optional proxy port

 

proxyPort

Integer

The optional proxy port

 

proxyUsername

String

The optional proxy username

 

proxyPassword

String

The optional proxy password

 

proxyDomain

String

The optional proxy domain

 

proxyWorkstation

String

The optional proxy workstation

 

socketTimeout

Integer

The amount of time to wait (in milliseconds) for data to be transferred over an established, open connection before the connection is timed out. A value of 0 means infinity, and is not recommended.

50000

 

connectionTimeout

Integer

The amount of time to wait (in milliseconds) when initially establishing a connection before giving up and timing out. A value of 0 means infinity, and is not recommended.

50000

 

Processors


Add permission

<sqs:add-permission>

Adds a permission to this message queue.

XML Sample

<sqs:add-permission label="message" config-ref="SQS">
<sqs:account-ids ref="accountIds"/>
<sqs:actions ref="actions"/>
</sqs:add-permission>

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

label

String

a name for this permission

x 

accountIds

List<String>

the AWS account ID's for the account to share this queue with

x 

actions

List<String>

a list to indicate how much to share (SendMessage, ReceiveMessage, ChangeMessageVisibility, DeleteMessage, GetQueueAttributes)

x 

queueUrl

String

Permissions will be added to the queue represented by this URL.

 


Change message visibility

<sqs:change-message-visibility>

Changes the visibility timeout of a specified message in a queue to a new value. The maximum allowed timeout value you can set the value to is 12 hours. This means you can't extend the timeout of a message in an existing queue to more than a total visibility timeout of 12 hours.

XML Sample

<sqs:change-message-visibility config-ref="SQS" receiptHandle="xyz123abc" visibilityTimeout="60"/>

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

receiptHandle

String

The receipt handle associated with the message whose visibility timeout should be changed.

#[header:inbound:sqs.message.receipt.handle]

 

visibilityTimeout

Integer

The new value (in seconds - from 0 to 43200 - maximum 12 hours) for the message's visibility timeout.

x 

queueUrl

String

The URL of the Amazon SQS queue to take action on.

 


Change message visibility batch

<sqs:change-message-visibility-batch>

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 10 ChangeMessageVisibility requests with each ChangeMessageVisibilityBatch action.

XML Sample

<sqs:change-message-visibility-batch config-ref="SQS">
<sqs:receipt-handles ref="receipts"/>
</sqs:change-message-visibility-batch>

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

receiptHandles

List<ChangeMessageVisibilityBatchRequestEntry>

A list of receipt handles of the messages for which the visibility timeout must be changed.

#[payload]

 

queueUrl

String

The URL of the Amazon SQS queue to take action on.

 

Returns

Return Java Type Description

ChangeMessageVisibilityBatchResult

ChangeMessageVisibilityBatchResult list items.


Create queue

<sqs:create-queue>

Creates a new queue, or returns the URL of an existing one.

XML Sample

<sqs:create-queue queueName="MySqsQueue" config-ref="SQS"/>

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

queueName

String

The name for the queue to be created.

x 

region

RegionEndpoint

The region in which the queue to be created.

 

attributes

Map<String,String>

+++A map of attributes with their corresponding values. Valid Map Keys: Policy

VisibilityTimeout

MaximumMessageSize

MessageRetentionPeriod

ApproximateNumberOfMessages

ApproximateNumberOfMessagesNotVisible

CreatedTimestamp

LastModifiedTimestamp

QueueArn

ApproximateNumberOfMessagesDelayed

DelaySeconds

ReceiveMessageWaitTimeSeconds

RedrivePolicy+++

Returns

Return Java Type Description

CreateQueueResult

CreateQueueResult object containing the URL of the created Amazon SQS queue.


Delete message

<sqs:delete-message>

Deletes the message identified by message object on the queue this object represents.

XML Sample

<sqs:delete-message receiptHandle="xyz123abc" config-ref="SQS"/>

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

receiptHandle

String

Receipt handle of the message to be deleted

#[header:inbound:sqs.message.receipt.handle]

 

queueUrl

String

The URL of the queue to delete messages from

 


Delete message batch

<sqs:delete-message-batch>

Deletes up to ten messages from the specified queue. This is a batch version of DeleteMessage.

XML Sample

<sqs:delete-message-batch config-ref="SQS">
<sqs:receipt-handles ref="receipts"/>
</sqs:delete-message-batch>

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

receiptHandles

List<DeleteMessageBatchRequestEntry>

A list of receipt handles for the messages to be deleted.

#[payload]

 

queueUrl

String

The URL of the queue to delete messages as a batch from.

 

Returns

Return Java Type Description

DeleteMessageBatchResult

DeleteMessageBatchResult


Delete queue

<sqs:delete-queue>

Deletes the message queue represented by this object. Will delete non-empty queue.

XML Sample

<sqs:delete-queue config-ref="SQS"/>

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

queueUrl

String

The URL of the queue to delete.

 


Get queue attributes

<sqs:get-queue-attributes>

Gets queue attributes. This is provided to expose the underlying functionality.

XML Sample

<sqs:get-queue-attributes config-ref="SQS">
<sqs:attribute-names ref="#[flowVars.attributeNames]"/>
</sqs:get-queue-attributes>

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

attributeNames

List<String>

A list of attribute retrieve information for.

#[payload]

 

queueUrl

String

The URL of the Amazon SQS queue to take action on.

 

Returns

Return Java Type Description

GetQueueAttributesResult

GetQueueAttributesResult object map containing attributes and their values


Get queue url

<sqs:get-queue-url>

Returns the URL of an existing queue.

XML Sample

<sqs:get-queue-url queueName="MySqsQueue" config-ref="SQS"/>

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

queueName

String

The name of the queue whose URL must be fetched.

x 

queueOwnerAWSAccountId

String

The AWS account ID of the owner that created the queue.

 

Returns

Return Java Type Description

GetQueueUrlResult

GetQueueUrlResult object containing the generated queue service url


List dead letter source queues

<sqs:list-dead-letter-source-queues>

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

XML Sample

<sqs:list-dead-letter-source-queues config-ref="SQS"/>

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

queueUrl

String

The queue URL of a dead letter queue.

 

Returns

Return Java Type Description

ListDeadLetterSourceQueuesResult

ListDeadLetterSourceQueuesResult object containing a list of source queue URLs that have the RedrivePolicy queue attribute configured with a dead letter queue.


List queues

<sqs:list-queues>

Returns a list of your queues. The maximum number of queues that can be returned is 1000.

XML Sample

<sqs:list-queues config-ref="SQS"/>

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

queueNamePrefix

String

A string to use for filtering the list results. Only those queues whose name begins with the specified string are returned.

 

Returns

Return Java Type Description

ListQueuesResult

ListQueuesResult object containing list of queue URLs.


Purge queue

<sqs:purge-queue>

Deletes the messages in a queue specified by the queue URL.

XML Sample

<sqs:purge-queue config-ref="SQS"/>

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

queueUrl

String

the queue URL where messages are to be fetched from.

 


Remove permission

<sqs:remove-permission>

Removes a permission from this message queue.

XML Sample

<sqs:remove-permission label="message" config-ref="SQS"/>

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

label

String

a name for the permission to be removed

x 

queueUrl

String

Permissions will be deleted from the queue represented by this URL.

 


Send message

<sqs:send-message>

Sends a message to a specified queue. The message must be between 1 and 256K bytes long.

XML Sample

<sqs:send-message config-ref="SQS">
    <sqs:message ref="#[payload]"/>
</sqs:send-message>

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

message

Message

Container for the parameters to the sendmessage operation.

#[payload]

 

queueUrl

String

the queue where the message is to be sent.

 

Returns

Return Java Type Description

SendMessageResult

The queue response of the sent message.


Send message batch

<sqs:send-message-batch>

Delivers up to ten messages to the specified queue. This is a batch version of SendMessage

XML Sample

<sqs:send-message-batch config-ref="SQS">
<sqs:messages ref="batchMessagesRef"/>
</sqs:send-message-batch>

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

messages

List<SendMessageBatchRequestEntry>

A list of SendMessageBatchRequestEntry items.

#[payload]

 

queueUrl

String

the queue where the message is to be sent.

 

Returns

Return Java Type Description

SendMessageBatchResult

SendMessageBatchResult list items.


Set queue attributes

<sqs:set-queue-attributes>

Sets the value of one or more queue attributes. When you change a queue's attributes, the change can take up to 60 seconds for most of the attributes to propagate throughout the SQS system. Changes made to the MessageRetentionPeriod attribute can take up to 15 minutes.

XML Sample

<sqs:set-queue-attributes config-ref="SQS">
<sqs:attributes>
<sqs:attribute key="MaximumMessageSize" value-ref="randomValueRef" />
</sqs:attributes>
</sqs:set-queue-attributes>

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

attributes

Map<String,String>

A map of attributes to set.

#[payload]

 

queueUrl

String

The URL of the queue.

 


Get approximate number of messages

<sqs:get-approximate-number-of-messages>

Gets an approximate number of visible messages for a queue.

XML Sample

<sqs:get-approximate-number-of-messages config-ref="SQS"/>

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

queueUrl

String

The URL of the queue

 

Returns

Return Java Type Description

int

the approximate number of messages in the queue

Sources


Receive messages

<sqs:receive-messages>

Attempts to receive messages from a queue. Every attribute of the incoming messages will be added as inbound properties. Also the following properties will also be added: sqs.message.id = containing the message identification sqs.message.receipt.handle = containing the message identification

XML Sample

<sqs:receive-messages config-ref="SQS"/>

Attributes

Name Java Type Description Default Value Required

config-ref

String

Specify which config to use

x 

callback

SourceCallback

Callback to call when new messages are available.

x 

visibilityTimeout

Integer

the duration (in seconds) the retrieved messages are hidden from subsequent calls to retrieve.

30

 

preserveMessages

Boolean

Flag that indicates if you want to preserve the messages in the queue. False by default, so the messages are going to be deleted.

false

 

numberOfMessages

Integer

the number of messages to be retrieved on each call (10 messages max). By default, 1 message will be retrieved.

1

 

queueUrl

String

the queue URL where messages are to be fetched from.

 

Returns

Return Java Type Description

void