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.5.0 or higher |
Configs
Configuration
<sqs:config>
Connection Management
Attributes
Name | Java Type | Description | Default Value | Required |
---|---|---|---|---|
name |
The name of this configuration. With this name can be later referenced. |
x |
||
accessKey |
AWS access key |
x |
||
secretKey |
AWS secret key |
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 |
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 |
Queue URL takes priority over the Queue Name and is required if Queue Name has not been defined. |
|
||
region |
Queue Region |
|
||
protocol |
Protocol |
The optional communication protocol to use when sending requests to AWS. Communication over HTTPS is the default |
|
|
proxyHost |
The optional proxy port |
|
||
proxyPort |
The optional proxy port |
|
||
proxyUsername |
The optional proxy username |
|
||
proxyPassword |
The optional proxy password |
|
||
proxyDomain |
The optional proxy domain |
|
||
proxyWorkstation |
The optional proxy workstation |
|
||
socketTimeout |
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 |
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.
../../../doc/mule-module-sqs.xml.sample sqs:add-permissionXML 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 |
Specify which config to use |
x |
||
label |
a name for this permission |
x |
||
accountIds |
the AWS account ID's for the account to share this queue with |
x |
||
actions |
a list to indicate how much to share (SendMessage, ReceiveMessage, ChangeMessageVisibility, DeleteMessage, GetQueueAttributes) |
x |
||
queueUrl |
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.
../../../doc/mule-module-sqs.xml.sample sqs:change-message-visibilityXML Sample
<sqs:change-message-visibility config-ref="SQS" receiptHandle="xyz123abc" visibilityTimeout="60"/>
Attributes
Name | Java Type | Description | Default Value | Required |
---|---|---|---|---|
config-ref |
Specify which config to use |
x |
||
receiptHandle |
The receipt handle associated with the message whose visibility timeout should be changed. |
#[header:inbound:sqs.message.receipt.handle] |
|
|
visibilityTimeout |
The new value (in seconds - from 0 to 43200 - maximum 12 hours) for the message's visibility timeout. |
x |
||
queueUrl |
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.
../../../doc/mule-module-sqs.xml.sample sqs:change-message-visibility-batchXML 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 |
Specify which config to use |
x |
||
receiptHandles |
A list of receipt handles of the messages for which the visibility timeout must be changed. |
#[payload] |
|
|
queueUrl |
The URL of the Amazon SQS queue to take action on. |
|
Returns
Return Java Type | Description |
---|---|
ChangeMessageVisibilityBatchResult list items. |
Create queue
<sqs:create-queue>
Creates a new queue, or returns the URL of an existing one.
../../../doc/mule-module-sqs.xml.sample sqs:create-queueXML Sample
<sqs:create-queue queueName="MySqsQueue" config-ref="SQS"/>
Attributes
Name | Java Type | Description | Default Value | Required |
---|---|---|---|---|
config-ref |
Specify which config to use |
x |
||
queueName |
The name for the queue to be created. |
x |
||
region |
The region in which the queue to be created. |
|
||
attributes |
+++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 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.
../../../doc/mule-module-sqs.xml.sample sqs:delete-messageXML Sample
<sqs:delete-message receiptHandle="xyz123abc" config-ref="SQS"/>
Delete message batch
<sqs:delete-message-batch>
Deletes up to ten messages from the specified queue. This is a batch version of DeleteMessage.
../../../doc/mule-module-sqs.xml.sample sqs:delete-message-batchXML 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 |
Specify which config to use |
x |
||
receiptHandles |
A list of receipt handles for the messages to be deleted. |
#[payload] |
|
|
queueUrl |
The URL of the queue to delete messages as a batch from. |
|
Delete queue
<sqs:delete-queue>
Deletes the message queue represented by this object. Will delete non-empty queue.
../../../doc/mule-module-sqs.xml.sample sqs:delete-queueXML Sample
<sqs:delete-queue config-ref="SQS"/>
Get queue attributes
<sqs:get-queue-attributes>
Gets queue attributes. This is provided to expose the underlying functionality.
../../../doc/mule-module-sqs.xml.sample sqs:get-queue-attributesXML 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 |
Specify which config to use |
x |
||
attributeNames |
A list of attribute retrieve information for. |
#[payload] |
|
|
queueUrl |
The URL of the Amazon SQS queue to take action on. |
|
Returns
Return Java Type | Description |
---|---|
GetQueueAttributesResult object map containing attributes and their values |
Get queue url
<sqs:get-queue-url>
Returns the URL of an existing queue.
../../../doc/mule-module-sqs.xml.sample sqs:get-queue-urlXML Sample
<sqs:get-queue-url queueName="MySqsQueue" config-ref="SQS"/>
Attributes
Name | Java Type | Description | Default Value | Required |
---|---|---|---|---|
config-ref |
Specify which config to use |
x |
||
queueName |
The name of the queue whose URL must be fetched. |
x |
||
queueOwnerAWSAccountId |
The AWS account ID of the owner that created the queue. |
|
Returns
Return Java Type | Description |
---|---|
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.
../../../doc/mule-module-sqs.xml.sample sqs:list-dead-letter-source-queuesXML Sample
<sqs:list-dead-letter-source-queues config-ref="SQS"/>
Attributes
Name | Java Type | Description | Default Value | Required |
---|---|---|---|---|
config-ref |
Specify which config to use |
x |
||
queueUrl |
The queue URL of a dead letter queue. |
|
Returns
Return Java Type | Description |
---|---|
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.
../../../doc/mule-module-sqs.xml.sample sqs:list-queuesXML Sample
<sqs:list-queues config-ref="SQS"/>
Attributes
Name | Java Type | Description | Default Value | Required |
---|---|---|---|---|
config-ref |
Specify which config to use |
x |
||
queueNamePrefix |
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 object containing list of queue URLs. |
Purge queue
<sqs:purge-queue>
Deletes the messages in a queue specified by the queue URL.
../../../doc/mule-module-sqs.xml.sample sqs:purge-queueXML Sample
<sqs:purge-queue config-ref="SQS"/>
Remove permission
<sqs:remove-permission>
Removes a permission from this message queue.
../../../doc/mule-module-sqs.xml.sample sqs:remove-permissionXML Sample
<sqs:remove-permission label="message" config-ref="SQS"/>
Send message
<sqs:send-message>
Sends a message to a specified queue. The message must be between 1 and 256K bytes long.
../../../doc/mule-module-sqs.xml.sample sqs:send-messageXML Sample
<sqs:send-message config-ref="SQS">
<sqs:message ref="#[payload]"/>
</sqs:send-message>
Attributes
Name | Java Type | Description | Default Value | Required |
---|---|---|---|---|
config-ref |
Specify which config to use |
x |
||
message |
Container for the parameters to the sendmessage operation. |
#[payload] |
|
|
queueUrl |
the queue where the message is to be sent. |
|
Send message batch
<sqs:send-message-batch>
Delivers up to ten messages to the specified queue. This is a batch version of SendMessage
../../../doc/mule-module-sqs.xml.sample sqs:send-message-batchXML 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 |
Specify which config to use |
x |
||
messages |
A list of SendMessageBatchRequestEntry items. |
#[payload] |
|
|
queueUrl |
the queue where the message is to be sent. |
|
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.
../../../doc/mule-module-sqs.xml.sample sqs:set-queue-attributesXML Sample
<sqs:set-queue-attributes config-ref="SQS">
<sqs:attributes>
<sqs:attribute key="MaximumMessageSize" value-ref="randomValueRef" />
</sqs:attributes>
</sqs:set-queue-attributes>
Get approximate number of messages
<sqs:get-approximate-number-of-messages>
Gets an approximate number of visible messages for a queue.
../../../doc/mule-module-sqs.xml.sample sqs:get-approximate-number-of-messagesXML Sample
<sqs:get-approximate-number-of-messages config-ref="SQS"/>
Attributes
Name | Java Type | Description | Default Value | Required |
---|---|---|---|---|
config-ref |
Specify which config to use |
x |
||
queueUrl |
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 ../../../doc/mule-module-sqs.xml.sample sqs:receive-messagesXML Sample
<sqs:receive-messages config-ref="SQS"/>
Attributes
Name | Java Type | Description | Default Value | Required |
---|---|---|---|---|
config-ref |
Specify which config to use |
x |
||
callback |
SourceCallback |
Callback to call when new messages are available. |
x |
|
visibilityTimeout |
the duration (in seconds) the retrieved messages are hidden from subsequent calls to retrieve. |
30 |
|
|
preserveMessages |
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 |
the number of messages to be retrieved on each call (10 messages max). By default, 1 message will be retrieved. |
1 |
|
|
queueUrl |
the queue URL where messages are to be fetched from. |
|
Returns
Return Java Type | Description |
---|---|
void |