camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [camel] branch camel-2.20.x updated: SQS Producer support for numeric attributes
Date Fri, 06 Apr 2018 08:13:19 GMT
This is an automated email from the ASF dual-hosted git repository.

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


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

commit dcf19c6ea0e40278cfd44f97fd70d6f405dad662
Author: Craig Andrews <candrews@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 6268ea8..5fae7f1 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
@@ -120,6 +120,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
acosentino@apache.org.

Mime
View raw message