Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.이 콘텐츠는 선택한 언어로 제공되지 않습니다.
8.8. AWS-SQS
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[?options]
aws-sqs://queue-name[?options]
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 |
---|---|---|---|
amazonSQSClient |
null
|
Shared |
Reference to a com.amazonaws.services.sqs.AmazonSQS in the Registry.
|
accessKey |
null
|
Shared | Amazon AWS Access Key |
secretKey |
null
|
Shared | Amazon AWS Secret Key |
amazonSQSEndpoint |
null
|
Shared | The region with which the AWS-SQS client wants to work with. |
attributeNames |
null
|
Consumer |
A list of attributes to set in the com.amazonaws.services.sqs.model.ReceiveMessageRequest .
|
defaultVisibilityTimeout |
null
|
Shared |
The visibility timeout (in seconds) to set in the com.amazonaws.services.sqs.model.CreateQueueRequest .
|
deleteAfterRead |
true
|
Consumer | Delete message from SQS after it has been read |
maxMessagesPerPoll |
null
|
Consumer |
The maximum number of messages which can be received in one poll to set in the com.amazonaws.services.sqs.model.ReceiveMessageRequest .
|
visibilityTimeout |
null
|
Shared |
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 com.amazonaws.services.sqs.model.SetQueueAttributesRequest . This only make sense if its different from defaultVisibilityTimeout . It changes the queue visibility timeout attribute permanently.
|
messageVisibilityTimeout |
null
|
Consumer |
Camel 2.8: 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 com.amazonaws.services.sqs.model.ReceiveMessageRequest . It does NOT change the queue visibility timeout attribute permanently.
|
extendMessageVisibility |
false
|
Consumer |
Camel 2.10: If enabled then a scheduled background task will keep extending the message visibility on SQS. This is needed if it taks a long time to process the message. If set to true defaultVisibilityTimeout must be set. See details at Amazon docs.
|
maximumMessageSize |
null
|
Shared |
Camel 2.8: The maximumMessageSize (in bytes) an SQS message can contain for this queue, to set in the com.amazonaws.services.sqs.model.SetQueueAttributesRequest .
|
messageRetentionPeriod |
null
|
Shared |
Camel 2.8: The messageRetentionPeriod (in seconds) a message will be retained by SQS for this queue, to set in the com.amazonaws.services.sqs.model.SetQueueAttributesRequest .
|
policy |
null
|
Shared |
Camel 2.8: The policy for this queue to set in the com.amazonaws.services.sqs.model.SetQueueAttributesRequest .
|
delaySeconds |
null
|
Producer | Camel 2.9.3: Delay sending messages for a number of seconds. |
waitTimeSeconds |
0
|
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 response. |
receiveMessageWaitTimeSeconds |
0
|
Shared | Camel 2.11: If you do not specify WaitTimeSeconds in the request, the queue attribute ReceiveMessageWaitTimeSeconds is used to determine how long to wait. |
queueOwnerAWSAccountId |
null
|
Camel 2.12: Specify the queue owner aws account id when you need to connect the queue with different account owner. |
Required SQS component options
You have to provide the amazonSQSClient in the Registry or your accessKey and secretKey to access the Amazon's SQS.
Batch Consumer 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
This component implements the Batch Consumer.
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.
Usage 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
Message headers set by the SQS producer 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
Header | Type | Description |
---|---|---|
CamelAwsSqsMD5OfBody
|
String
|
The MD5 checksum of the Amazon SQS message. |
CamelAwsSqsMessageId
|
String
|
The Amazon SQS message ID. |
CamelAwsSqsDelaySeconds
|
Integer
|
Since Camel 2.11, the delay seconds that the Amazon SQS message can be see by others. |
Message headers set by the SQS consumer 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
Header | Type | Description |
---|---|---|
CamelAwsSqsMD5OfBody
|
String
|
The MD5 checksum of the Amazon SQS message. |
CamelAwsSqsMessageId
|
String
|
The Amazon SQS message ID. |
CamelAwsSqsReceiptHandle
|
String
|
The Amazon SQS message receipt handle. |
CamelAwsSqsAttributes
|
Map<String, String>
|
The Amazon SQS message attributes. |
Advanced AmazonSQS configuration 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
If your Camel Application is running behind a firewall or if you need to have more control over the AmazonSQS instance configuration, you can create your own instance:
and refer to it in your Camel aws-sqs component configuration:
from("aws-sqs://MyQueue?amazonSQSClient=#client&delay=5000&maxMessagesPerPoll=5") .to("mock:result");
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.
pom.xml
where
$\{camel-version\}
must be replaced by the actual version of Camel (2.6 or higher).