This is an automated email from the ASF dual-hosted git repository.

aldettinger pushed a commit to branch camel-2.21.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 9787f4613297d031b1f7291f3c7939d68bd853fa
Author: Craig Andrews <candr...@integralblue.com>
AuthorDate: Fri May 11 16:50:17 2018 -0400

    CAMEL-12506: SQS Producer support for boolean attributes
    
    If a header of type `Boolean` is provided, map it to an SQS 
`MessageAttributeValue` of type "Number" with the`MessageAttributeValue`'s 
StringValue being "1" for true and "0" for false.
    
    This behavior matches that of amazon-sqs-java-messaging-lib: 
https://github.com/awslabs/amazon-sqs-java-messaging-lib/blob/1.0.4/src/main/java/com/amazon/sqs/javamessaging/message/SQSMessage.java#L1146
    
    See 
https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html
    
    (cherry picked from commit 22556949a2c8ca0d7b0e3078a3b39f067bcf8bc5)
---
 .../main/java/org/apache/camel/component/aws/sqs/SqsProducer.java    | 5 +++++
 1 file changed, 5 insertions(+)

diff --git 
a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsProducer.java
 
b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsProducer.java
index 5257f6e..cf636fb 100644
--- 
a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsProducer.java
+++ 
b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsProducer.java
@@ -135,6 +135,11 @@ public class SqsProducer extends DefaultProducer {
                     mav.setDataType("Binary");
                     mav.withBinaryValue((ByteBuffer)value);
                     result.put(entry.getKey(), mav);
+                } else if (value instanceof Boolean) {
+                    MessageAttributeValue mav = new MessageAttributeValue();
+                    mav.setDataType("Number.Boolean");
+                    mav.withStringValue(((Boolean)value)?"1":"0");
+                    result.put(entry.getKey(), mav);
                 } else if (value instanceof Number) {
                     MessageAttributeValue mav = new MessageAttributeValue();
                     final String dataType;

-- 
To stop receiving notification emails like this one, please contact
aldettin...@apache.org.

Reply via email to