javaamazon-sqsapache-camel-aws

How to send a message MessageGroupID and MessageDeduplicationID to amazonSQS using camel-aws


Could we send a message to Amazon SQS "FIFO" queue using the Java-DSL syntax:

from("..")..to("aws-sqs://testSQSFifo.fifo?amazonSQSClient=#amazonSQSClient);

Keep in mind that: this is a FIFO queue, so it needs MessageGroupID and MessageDeduplicationID.


Solution

  • try to use the following syntax:

    from("..")..to("aws-sqs://testSQSFifo.fifo?amazonSQSClient=#amazonSQSClient&messageGroupIdStrategy=STRATEGY);
    

    where STRATEGY can be one of the following options: useConstant, useExchangeId, usePropertyValue. For the usePropertyValue option, the value of property CamelAwsMessageGroupId will be used.

    see: https://github.com/apache/camel/blob/master/components/camel-aws-sqs/src/main/docs/aws-sqs-component.adoc