You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by murmav <nu...@gmail.com> on 2016/08/06 02:55:19 UTC

Apache camel and SQS Extended Client Library

So. As you know AWS Simple Queue Service has some limitation on a message's
size. There is also a library called  Extended Client Library
<https://github.com/awslabs/amazon-sqs-java-extended-client-lib>   that help
us to avoid this limitation by using S3 bucket storage. And I also use
Apache Camel to manage my queues.I think I just misunderstand the
conception, but I have the problem to make Apache Camel And Extended SQS
Library work together.So first of all I defined a new
routefrom("aws-sqs://queue?amazonSQSClient=#sqsClient" +           
"&maxMessagesPerPoll=10" +            "&deleteAfterRead=false" +           
"&concurrentConsumers=10" +            "&attributeNames=All" +           
"&messageAttributeNames=All"        ).log(body());sqsClient is defined
inside a camel-context.xml                                                       
And this point there is no problem dealing with messages up to 256 kb.Let's
go further. The Extended SQS Library detects if the message is bigger 256 kb
and makes a reference to the file inside S3 storage. And simple fetchs it
later.["com.amazon.sqs.javamessaging.MessageS3Pointer",{"s3BucketName":"test-bucket-ascelhem","s3Key":"b022dfd8-ed40-4213-a41e-5a0e82090ef4"}]There
are some pre-configuration before the client is able to use it:First of all
we set the SQS extended client configuration with large payload support
enabled.ExtendedClientConfiguration extendedClientConfig = new
ExtendedClientConfiguration().withLargePayloadSupportEnabled(s3,
s3BucketName);And finallyAmazonSQS sqsExtended = new
AmazonSQSExtendedClient(new AmazonSQSClient(credentials),
extendedClientConfig);        Region sqsRegion =
Region.getRegion(Regions.US_WEST_1);       
sqsExtended.setRegion(sqsRegion);So can I configure it via Spring DSL or
should I fetch the message and inside a processor get the message body?Next,
it's a method that help us to fetch message body.    ReceiveMessageRequest
receiveMessageRequest = new ReceiveMessageRequest(myQueueUrl);    List
messages =
sqsExtended.receiveMessage(receiveMessageRequest).getMessages();Does the
Apache camel overrides somehow getMessage? Because inside the app we can get
message body by calling method body().And if there is an opportunity to
configure Apache Camel in such way so that it can handle very-big-messages,
the line new
ExtendedClientConfiguration().withLargePayloadSupportEnabled(s3,
s3BucketName); confused me a lot because I have no idea how to call static
method inside xml file.And finally the lineHere we use AmazonSQSAsyncClient,
but as I mentioned earlier, the Extended Client Library initializes via
AmazonSQS ... interface? So, I'm totally trapped.Also I've fount the example
of using this library. It might be helpful for you.Thanks.



--
View this message in context: http://camel.465427.n5.nabble.com/Apache-camel-and-SQS-Extended-Client-Library-tp5786090.html
Sent from the Camel - Users mailing list archive at Nabble.com.