Amazon SQS Connector 5.9 Additional Configuration Information - Mule 4
Configure additional functionality such as controlling polling behavior globally and locally, receiving messages on the primary node only, creating the FIFO queue, and managing large payloads.
Since version 5.9, the default behavior of the Receive Messages source and the Read operation is to use long polling:
With long polling, SQS Connector returns the query results as soon as possible, if any messages are present.
Otherwise, SQS Connector waits the specified amount of seconds before returning an empty response.
With short polling, SQS Connector always returns the query results as soon as possible, even if that means returning an empty response.
Long polling can reduce the number of network requests without affecting the throughput.
You can control polling behavior either globally or at the individual source and operation level.
To control polling behavior globally, use the Default Wait Time field on the Advanced tab of the global element configuration screen for the Receive Messages source, Read operation, or both:
Set this field to a value between
20to use long polling. With long polling, if there are messages available immediately, the connector returns the query results immediately. If not, the connector waits up to the specified amount of seconds for a message to be added before returning an empty response.
Set this field to
0to use short polling. With short polling, the connector always returns the query results as soon as possible, even if that means returning an empty response.
In the following screenshot, the Default Wait Time field is set to
20. This value directs the connector to use long polling and to wait 20 seconds before returning an empty response.
The default behavior of the Receive Messages source is to receive messages on all nodes when running in cluster mode.
If you want the app to receive messages on the primary node only:
In Studio, select the Receive Messages source for your flow.
On the Advanced sub-tab of the Receive messages tab, select the Primary node only checkbox:
The multi-node cluster behavior depends on the selected SQS queue type. When using the Standard queue, SQS guarantees that a message is delivered at least once. However, duplicate messages might be introduced in the queue. To avoid duplication of messages in the queue, you can use a FIFO (First-In-First-Out) queue to ensure that a message is delivered only once and that it remains available until a consumer processes and deletes it.
FIFO queues deliver messages in the order in which they are sent.
To create the FIFO queue, use the Create queue operation in the connector, and set the FifoQueue and ContentBasedDeduplication field values to
End the queue name value with the
.fifo extension, for example:
When you create the FIFO queues, select any of the 15 regions that Amazon supports.
When you use Amazon SQS Connector to send messages to the FIFO queue, use the same queue URL and region name that you used when creating the FIFO queue. You must also provide a value for the attribute
message group id in the connector configuration while sending messages.
To enable support for managing large message payloads in Amazon SQS Connector, follow these steps:
In Studio, click the Global Elements tab at the base of the canvas.
Select the Amazon SQS Configuration you previously created and click Edit.
In the Connection section, click the Advanced tab.
In the Large Payload Support field, choose either:
Expression or Bean Reference
Configure the parameters as follows:
Name of the bucket to use for storing large message payloads. The bucket must already be created and configured in AWS S3. Enabling this feature incurs additional charges for using AWS S3.
Message Size Threshold
Message size threshold value for storing message payloads in the AWS S3 bucket. The default value for message size threshold is 256 KB and the maximum threshold size value is 256KB. The maximum message size is 2GB.
Message Size Threshold Unit
Represents the data unit for the message size threshold.
After you specify the values for these fields, Amazon SQS Connector is ready to manage large payload messages and store them automatically in the specified AWS S3 bucket when the message size threshold value is exceeded.
For an example of sending and receiving messages with large payload messages, see Send and Receive Large Messages Example.
After you create the FIFO queue, you can try the Amazon SQS Connector Examples.