This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 4f3067b760414c8fb7cb2cabc09f86b4617f0d16 Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Mon Feb 17 11:53:50 2020 +0100 CAMEL-14553 - Create an AWS-SQS component based on SDK v2, docs --- ...-sqs-component.adoc => aws2-sqs-component.adoc} | 41 +++++++--------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/components/camel-aws2-sqs/src/main/docs/aws-sqs-component.adoc b/components/camel-aws2-sqs/src/main/docs/aws2-sqs-component.adoc similarity index 93% rename from components/camel-aws2-sqs/src/main/docs/aws-sqs-component.adoc rename to components/camel-aws2-sqs/src/main/docs/aws2-sqs-component.adoc index 0ef2a20..c1001cf 100644 --- a/components/camel-aws2-sqs/src/main/docs/aws-sqs-component.adoc +++ b/components/camel-aws2-sqs/src/main/docs/aws2-sqs-component.adoc @@ -1,5 +1,5 @@ -[[aws-sqs-component]] -= AWS Simple Queue Service Component +[[aws2-sqs-component]] += AWS 2 Simple Queue Service Component *Since Camel 2.6* @@ -20,7 +20,7 @@ https://aws.amazon.com/sqs[Amazon SQS]. [source,java] ------------------------------ -aws-sqs://queueNameOrArn[?options] +aws2-sqs://queueNameOrArn[?options] ------------------------------ The queue will be created if they don't already exists. + @@ -196,27 +196,12 @@ see by others. === 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 +have more control over the SqsClient instance configuration, you can create your own instance: [source,java] --------------------------------------------------------------------------------------- -AWSCredentials awsCredentials = new BasicAWSCredentials("myAccessKey", "mySecretKey"); - -ClientConfiguration clientConfiguration = new ClientConfiguration(); -clientConfiguration.setProxyHost("http://myProxyHost"); -clientConfiguration.setProxyPort(8080); - -AmazonSQS client = new AmazonSQSClient(awsCredentials, clientConfiguration); - -registry.bind("client", client); --------------------------------------------------------------------------------------- - -and refer to it in your Camel aws-sqs component configuration: - -[source,java] --------------------------------------------------------------------------------- -from("aws-sqs://MyQueue?amazonSQSClient=#client&delay=5000&maxMessagesPerPoll=5") +from("aws2-sqs://MyQueue?amazonSQSClient=#client&delay=5000&maxMessagesPerPoll=5") .to("mock:result"); --------------------------------------------------------------------------------- @@ -228,7 +213,7 @@ mapping with the SQSConfiguration option. [source,java] --------------------------------------------------------------------------------- -from("aws-sqs://MyQueue?amazonSQSClient=#client&delay=5000&maxMessagesPerPoll=5") +from("aws2-sqs://MyQueue?amazonSQSClient=#client&delay=5000&maxMessagesPerPoll=5") .to("mock:result"); --------------------------------------------------------------------------------- @@ -262,7 +247,7 @@ Maven users will need to add the following dependency to their pom.xml. --------------------------------------- <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-aws-sqs</artifactId> + <artifactId>camel-aws2-sqs</artifactId> <version>${camel-version}</version> </dependency> --------------------------------------- @@ -283,7 +268,7 @@ of the route, use a Filter: [source,java] ------------------------------------------------------------------------------------------------------ -from("aws-sqs://MyQueue?amazonSQSClient=#client&defaultVisibilityTimeout=5000&deleteIfFiltered=false&deleteAfterRead=false") +from("aws2-sqs://MyQueue?amazonSQSClient=#client&defaultVisibilityTimeout=5000&deleteIfFiltered=false&deleteAfterRead=false") .filter("${header.login} == true") .to("mock:result"); ------------------------------------------------------------------------------------------------------ @@ -305,7 +290,7 @@ You can set a `SendMessageBatchRequest` or an `Iterable` ------------------------------------------------------------------------------------------------------ from("direct:start") - .setHeader(SqsConstants.SQS_OPERATION, constant("sendBatchMessage")).to("aws-sqs://camel-1?accessKey=RAW(xxx)&secretKey=RAW(xxx)®ion=EU_WEST_1"); + .setHeader(SqsConstants.SQS_OPERATION, constant("sendBatchMessage")).to("aws2-sqs://camel-1?accessKey=RAW(xxx)&secretKey=RAW(xxx)®ion=EU_WEST_1"); ------------------------------------------------------------------------------------------------------ As result you'll get an exchange containing a `SendMessageBatchResult` instance, that you can examinate to check what messages were successfull and what not. @@ -319,7 +304,7 @@ Use deleteMessage operation to delete a single message. You'll need to set a rec from("direct:start") .setHeader(SqsConstants.SQS_OPERATION, constant("deleteMessage")) .setHeader(SqsConstants.RECEIPT_HANDLE, constant("123456")) - .to("aws-sqs://camel-1?accessKey=RAW(xxx)&secretKey=RAW(xxx)®ion=EU_WEST_1"); + .to("aws2-sqs://camel-1?accessKey=RAW(xxx)&secretKey=RAW(xxx)®ion=EU_WEST_1"); ------------------------------------------------------------------------------------------------------ As result you'll get an exchange containing a `DeleteMessageResult` instance, that you can use to check if the message was deleted or not. @@ -330,7 +315,7 @@ Use listQueues operation to list queues. ------------------------------------------------------------------------------------------------------ from("direct:start") - .setHeader(SqsConstants.SQS_OPERATION, constant("listQueues")).to("aws-sqs://camel-1?accessKey=RAW(xxx)&secretKey=RAW(xxx)®ion=EU_WEST_1"); + .setHeader(SqsConstants.SQS_OPERATION, constant("listQueues")).to("aws2-sqs://camel-1?accessKey=RAW(xxx)&secretKey=RAW(xxx)®ion=EU_WEST_1"); ------------------------------------------------------------------------------------------------------ As result you'll get an exchange containing a `ListQueuesResult` instance, that you can examinate to check the actual queues. @@ -340,9 +325,9 @@ As result you'll get an exchange containing a `ListQueuesResult` instance, that With the option `autoCreateQueue` users are able to avoid the autocreation of an SQS Queue in case it doesn't exist. The default for this option is `true`. If set to false any operation on a not-existent queue in AWS won't be successful and an error will be returned. -== Automatic detection of AmazonSQS client in registry +== Automatic detection of SqsClient client in registry -The component is capable of detecting the presence of an AmazonSQS bean into the registry. +The component is capable of detecting the presence of an SqsClient bean into the registry. If it's the only instance of that type it will be used as client and you won't have to define it as uri parameter. This may be really useful for smarter configuration of the endpoint.