...
URI Format
Code Block |
---|
aws-sqs://queue-namequeueName[?options] aws-sqs://queueNameOrArn[?options] (from Camel 2.18) |
The queue will be created if they don't already exists.
You can append query options to the URI in the following format, : ?options=value&option2=value&...
URI Options
Name | Default Value | Context | Description | ||||
---|---|---|---|---|---|---|---|
|
|
| Amazon AWS Access Key. | ||||
|
|
| Reference to a | ||||
accessKey |
| Shared | Amazon AWS Access Key | ||||
secretKey |
| Shared | Amazon AWS Secret Key | ||||
|
|
| The region with which the AWSthe | ||||
|
|
| A list of attributes to set in the Camel 2.17: Multiple names can be separated by comma. Camel 2.16 or older: The type is a Collection so its much harder to configure and use. | ||||
| 1 | Consumer | (as of 2.15.0) Allows you to use multiple threads to poll the | sqsSQS queue to increase throughput. You must also set the maxMessagesPerPoll option for this to work properly. | |||
|
|
| The visibility timeout (in seconds) to set in the | ||||
|
|
| Camel 2.9.3: Delay sending messages for a number of seconds. | ||||
|
|
| Delete message from SQS after it has been read (and processed by the route). If this option is false, then the same objects will be retrieve over and over again on the polls. Therefore you need to use the Idempotent Consumer EIP in the route to filter out duplicates. You can filter using the | ||||
|
|
| Camel 2.12.2, 2.13.0: Whether or not to send the the If | maxMessagesPerPoll |
| Consumer | The maximum number of messages which can be received in one poll to set in the |
visibilityTimeout |
| Shared | The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request. This only make sense if its different from | ||||
|
|
| Camel 2.10: If enabled a scheduled background task will keep extending the message visibility on SQS. This is needed if it takes a long time to process the message. If set to true See details at Amazon docs. | ||||
|
|
| Camel 2.8: The The | ||||
|
|
| The maximum number of messages which can be received in one poll to set in the | ||||
messageAttributeNames | null | Consumer | A list of message attribute names to receive when consuming. Camel 2.17: Multiple names can be separated by comma. Camel 2.16 or older: The type is a Collection so its much harder to configure and use. | ||||
|
|
| Camel 2.8: The The | ||||
policy | null | Shared | Camel 2.8: The policy for this queue to set in the com.amazonaws.services.sqs.model.SetQueueAttributesRequest .16: Specify a proxy host to be used inside the client definition. | ||||
| null | Shared | delaySeconds |
| Producer | Camel 2.9.3: Delay sending messages for a number of seconds.16: Specify a proxy port to be used inside the client definition. | |
|
|
| waitTimeSeconds |
| Producer | Camel 2.11: Duration in seconds (0 to 20) that the ReceiveMessage action call will wait until a message is in the queue to include in the response12: Specify the queue owner aws account id when you need to connect the queue with different account owner. | |
|
|
| Camel 2.8: The policy for this queue to set in the | ||||
|
|
| Camel 2.11: If you do not specify specify | ||||
queueOwnerAWSAccountId | null | Shared | Camel 2.1215: Specify the queue owner aws account id when you need to connect the queue with different account ownerpolicy that send message to DeadLetter queue. See detail at Amazon docs. | ||||
|
|
| Camel 2.12.3: Specify the queue region which could be used with | ||||
|
|
| Camel 2.15: Specify the policy that send message to DeadLetter queue. See detail at Amazon docs. | proxyHost | null | Amazon AWS Secret Key. | |
|
|
| Camel 2. 16: Specify a proxy host to be used inside the client definition.11: Duration in seconds (0 to 20) that the | ||||
| proxyPort
|
| Camel 2.16: Specify a proxy port to be used inside the client definitionThe duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a |
Info | ||
---|---|---|
| ||
You have to provide the the |
...
Code Block | ||
---|---|---|
| ||
from("aws-sqs://MyQueue?amazonSQSClient=#client&delay=5000&maxMessagesPerPoll=5")
.to("mock:result");
|
Dependencies
Maven users will need to add the following dependency to their pom.xml
.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<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).
...
SQS does not allow selectors, but you can effectively achieve this by using the Camel Filter EIP and setting an appropriate visibilityTimeout
. When SQS dispatches a message, it will wait up to the visibility timeout before it will try to dispatch the message to a different consumer unless a a DeleteMessage
is received. By default, Camel will always send the the DeleteMessage
at the end of the route, unless the route ended in failure. To achieve appropriate filtering and not send the the DeleteMessage
even on successful completion of the route, use a Filter:
Code Block | ||
---|---|---|
| ||
from("aws-sqs://MyQueue?amazonSQSClient=#client&defaultVisibilityTimeout=5000&deleteIfFiltered=false") .filter("${header.login} == true") .to("mock:result"); |
In the above code, if an exchange doesn't have an appropriate header, it will not make it through the filter AND also not be deleted from the SQS queue. After After 5000
miliseconds, the message will become visible to other consumers.
...