SQS Component
Available as of Camel 2.6
The sqs component supports sending and receiving messages to Amazon's SQS service.
Prerequisites
You must have a valid Amazon Web Services developer account, and be signed up to use Amazon SQS. More information are available at Amazon SQS.
URI Format
aws-sqs://queue-name
URI Options
Name |
Default Value |
Context |
Description |
---|---|---|---|
amazonSQSClient |
|
Shared |
Reference to a com.amazonaws.services.sqs.AmazonSQSClient in the Registry. |
accessKey |
|
Shared |
Amazon AWS Access Key |
secretKey |
|
Shared |
Amazon AWS Secret Key |
attributeNames |
|
Consumer |
A list of attributes to set in the |
defaultVisibilityTimeout |
|
Shared |
The visibility timeout (in seconds) to set in the |
deleteAfterRead |
|
Consumer |
Delete message from SQS after it has been read |
maxMessagesPerPoll |
|
Consumer |
The maximum number of messages which can be received in one poll to set in the |
visibilityTimeout |
|
Consumer |
The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request to set in the |
Required SQS component options
You have to provide the amazonSQSClient in the Registry or your accessKey and secretKey to access the Amazon's SQS.
Usage
Batch Consumer
This component implements the Batch Consumer.
Message headers producer
Header |
Type |
Description |
---|---|---|
|
|
The MD5 checksum of the Amazon SQS message. |
|
|
The Amazon SQS message ID. |
Message headers consumer
Header |
Type |
Description |
---|---|---|
|
|
The MD5 checksum of the Amazon SQS message. |
|
|
The Amazon SQS message ID. |
|
|
The Amazon SQS message receipt handle. |
|
|
The Amazon SQS message attributes. |
Exchange Properties, sqs consumer only
As the sqs consumer is BatchConsumer
it supports batching the messages it polls. By batching it means that Camel will add some properties to the Exchange so you know the number of messages polled the current index in that order.
Property |
Description |
---|---|
|
The total number of messages that was polled in this batch. |
|
The current index of the batch. Starts from 0. |
|
A |
|
The returned attribute |
|
A reference to so that method calls can be chained together (e.g. the delete request after the message is consumed). |
This allows you for instance to know how many messages exists in this batch and for instance let the Aggregator aggregate this number of messages.
Dependencies
Maven users will need to add the following dependency to their pom.xml.
<dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-aws</artifactId> <version>${camel-version}</version> </dependency>
where ${camel-version
} must be replaced by the actual version of Camel (2.6 or higher).