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

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


The following commit(s) were added to refs/heads/camel-2.21.x by this push:
     new d0a92a5  SQS Producer support for numeric attributes
d0a92a5 is described below

commit d0a92a5983eb4613a6571eb0de0e23809a927e28
Author: Craig Andrews <candr...@integralblue.com>
AuthorDate: Thu Apr 5 17:09:30 2018 -0400

    SQS Producer support for numeric attributes
    
    If a header of type `Number` is provided, map it to an SQS 
`MessageAttributeValue` of type "Number" with the`MessageAttributeValue`'s 
StringValue containing a string representation of the number.
    
    See 
https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html
---
 .../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 04a66e0..231f9b6 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 Number) {
+                    MessageAttributeValue mav = new MessageAttributeValue();
+                    mav.setDataType("Number");
+                    mav.withStringValue(((Number)value).toString());
+                    result.put(entry.getKey(), mav);
                 } else {
                     // cannot translate the message header to message 
attribute value
                     LOG.warn("Cannot put the message header key={}, value={} 
into Sqs MessageAttribute", entry.getKey(), entry.getValue());

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

Reply via email to