You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by al...@apache.org on 2018/05/13 18:03:46 UTC

[camel] branch camel-2.21.x updated (ef9f8f9 -> ecf401b)

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

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


    from ef9f8f9  CAMEL-12487: S3Producer must close the streams it opens
     new 1c935ac  CAMEL-12507: SQS Producer support for number custom types
     new 9787f46  CAMEL-12506: SQS Producer support for boolean attributes
     new ecf401b  Fixed CS in camel-aws

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel/component/aws/sqs/SqsProducer.java       | 23 +++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

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

[camel] 03/03: Fixed CS in camel-aws

Posted by al...@apache.org.
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 ecf401b977b0b06b2e4d848cf55e4dac4f0ca4b6
Author: aldettinger <al...@gmail.com>
AuthorDate: Sat May 12 17:11:33 2018 +0200

    Fixed CS in camel-aws
    
    (cherry picked from commit ca2bb2bb8d96a1ff8b715ebf7cc2ee8651ddbba8)
---
 .../src/main/java/org/apache/camel/component/aws/sqs/SqsProducer.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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 cf636fb..eac5b22 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
@@ -138,12 +138,12 @@ public class SqsProducer extends DefaultProducer {
                 } else if (value instanceof Boolean) {
                     MessageAttributeValue mav = new MessageAttributeValue();
                     mav.setDataType("Number.Boolean");
-                    mav.withStringValue(((Boolean)value)?"1":"0");
+                    mav.withStringValue(((Boolean)value) ? "1" : "0");
                     result.put(entry.getKey(), mav);
                 } else if (value instanceof Number) {
                     MessageAttributeValue mav = new MessageAttributeValue();
                     final String dataType;
-                    if(value instanceof Integer) {
+                    if (value instanceof Integer) {
                         dataType = "Number.int";
                     } else if (value instanceof Byte) {
                         dataType = "Number.byte";

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

[camel] 01/03: CAMEL-12507: SQS Producer support for number custom types

Posted by al...@apache.org.
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 1c935ac98c01480f902a4d40c43736cfd6475942
Author: Craig Andrews <ca...@integralblue.com>
AuthorDate: Fri May 11 17:00:23 2018 -0400

    CAMEL-12507: SQS Producer support for number custom types
    
    If a header of type `Number` is provided, set the dataType to "Number." + an appropriate identifier
    
    These dataType values match those used by 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/SQSMessagingClientConstants.java#L39
    
    See https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html
    
    (cherry picked from commit f7263397a0968e8ad0a6ec79adf43027c8d19bde)
---
 .../apache/camel/component/aws/sqs/SqsProducer.java    | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

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 231f9b6..5257f6e 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
@@ -137,7 +137,23 @@ public class SqsProducer extends DefaultProducer {
                     result.put(entry.getKey(), mav);
                 } else if (value instanceof Number) {
                     MessageAttributeValue mav = new MessageAttributeValue();
-                    mav.setDataType("Number");
+                    final String dataType;
+                    if(value instanceof Integer) {
+                        dataType = "Number.int";
+                    } else if (value instanceof Byte) {
+                        dataType = "Number.byte";
+                    } else if (value instanceof Double) {
+                        dataType = "Number.double";
+                    } else if (value instanceof Float) {
+                        dataType = "Number.float";
+                    } else if (value instanceof Long) {
+                        dataType = "Number.long";
+                    } else if (value instanceof Short) {
+                        dataType = "Number.short";
+                    } else {
+                        dataType = "Number";
+                    }
+                    mav.setDataType(dataType);
                     mav.withStringValue(((Number)value).toString());
                     result.put(entry.getKey(), mav);
                 } else {

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

[camel] 02/03: CAMEL-12506: SQS Producer support for boolean attributes

Posted by al...@apache.org.
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 <ca...@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
aldettinger@apache.org.