You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2021/03/31 07:22:42 UTC

[camel] branch master updated (73c674b -> e1dfffe)

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

acosentino pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 73c674b  CAMEL-16413: camel-kafka - KafkaConsumer should not during stopping/shutdown force commit offset if partiotion is revoked event is triggered, but commit accordingly to autoCommitOnStop configuration.
     new 72400a4  Camel-AWS2-Lambda: Producer operations refactoring - untagResource
     new e1dfffe  Fixed CS

The 2 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:
 .../component/aws2/lambda/Lambda2Producer.java     | 57 +++++++++-------------
 1 file changed, 24 insertions(+), 33 deletions(-)

[camel] 01/02: Camel-AWS2-Lambda: Producer operations refactoring - untagResource

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 72400a4d61f4d6012a62b6fa4a27410ac63cf7ca
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Mar 31 09:16:11 2021 +0200

    Camel-AWS2-Lambda: Producer operations refactoring - untagResource
---
 .../component/aws2/lambda/Lambda2Producer.java     | 29 ++++++++--------------
 1 file changed, 10 insertions(+), 19 deletions(-)

diff --git a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
index 8d4e574..1f69e19 100644
--- a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
+++ b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
@@ -536,43 +536,34 @@ public class Lambda2Producer extends DefaultProducer {
 
     @SuppressWarnings("unchecked")
     private void untagResource(LambdaClient lambdaClient, Exchange exchange) throws InvalidPayloadException {
+    	UntagResourceRequest request = null;
+    	UntagResourceResponse result;
         if (getConfiguration().isPojoRequest()) {
-            Object payload = exchange.getIn().getMandatoryBody();
-            if (payload instanceof UntagResourceRequest) {
-                UntagResourceResponse result;
-                try {
-                    result = lambdaClient.untagResource((UntagResourceRequest) payload);
-                } catch (AwsServiceException ase) {
-                    LOG.trace("untagResource command returned the error code {}", ase.awsErrorDetails().errorCode());
-                    throw ase;
-                }
-                Message message = getMessageForResponse(exchange);
-                message.setBody(result);
-            }
+            request = exchange.getIn().getMandatoryBody(UntagResourceRequest.class);
         } else {
-            UntagResourceResponse result;
-            try {
-                UntagResourceRequest.Builder request = UntagResourceRequest.builder();
+                UntagResourceRequest.Builder builder = UntagResourceRequest.builder();
                 if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(Lambda2Constants.RESOURCE_ARN))) {
                     String resource = exchange.getIn().getHeader(Lambda2Constants.RESOURCE_ARN, String.class);
-                    request.resource(resource);
+                    builder.resource(resource);
                 } else {
                     throw new IllegalArgumentException("The resource ARN must be specified");
                 }
                 if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(Lambda2Constants.RESOURCE_TAG_KEYS))) {
                     List<String> tagKeys = exchange.getIn().getHeader(Lambda2Constants.RESOURCE_TAG_KEYS, List.class);
-                    request.tagKeys(tagKeys);
+                    builder.tagKeys(tagKeys);
                 } else {
                     throw new IllegalArgumentException("The tag keys must be specified");
                 }
-                result = lambdaClient.untagResource(request.build());
+                request = builder.build();
+        }
+        try {
+                result = lambdaClient.untagResource(request);
             } catch (AwsServiceException ase) {
                 LOG.trace("untagResource command returned the error code {}", ase.awsErrorDetails().errorCode());
                 throw ase;
             }
             Message message = getMessageForResponse(exchange);
             message.setBody(result);
-        }
     }
 
     private void publishVersion(LambdaClient lambdaClient, Exchange exchange) throws InvalidPayloadException {

[camel] 02/02: Fixed CS

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit e1dfffebedb5376941aee9a762aef992121e6a83
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Mar 31 09:20:16 2021 +0200

    Fixed CS
---
 .../component/aws2/lambda/Lambda2Producer.java     | 46 +++++++++++-----------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
index 1f69e19..6ae671b 100644
--- a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
+++ b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
@@ -536,34 +536,34 @@ public class Lambda2Producer extends DefaultProducer {
 
     @SuppressWarnings("unchecked")
     private void untagResource(LambdaClient lambdaClient, Exchange exchange) throws InvalidPayloadException {
-    	UntagResourceRequest request = null;
-    	UntagResourceResponse result;
+        UntagResourceRequest request = null;
+        UntagResourceResponse result;
         if (getConfiguration().isPojoRequest()) {
             request = exchange.getIn().getMandatoryBody(UntagResourceRequest.class);
         } else {
-                UntagResourceRequest.Builder builder = UntagResourceRequest.builder();
-                if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(Lambda2Constants.RESOURCE_ARN))) {
-                    String resource = exchange.getIn().getHeader(Lambda2Constants.RESOURCE_ARN, String.class);
-                    builder.resource(resource);
-                } else {
-                    throw new IllegalArgumentException("The resource ARN must be specified");
-                }
-                if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(Lambda2Constants.RESOURCE_TAG_KEYS))) {
-                    List<String> tagKeys = exchange.getIn().getHeader(Lambda2Constants.RESOURCE_TAG_KEYS, List.class);
-                    builder.tagKeys(tagKeys);
-                } else {
-                    throw new IllegalArgumentException("The tag keys must be specified");
-                }
-                request = builder.build();
+            UntagResourceRequest.Builder builder = UntagResourceRequest.builder();
+            if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(Lambda2Constants.RESOURCE_ARN))) {
+                String resource = exchange.getIn().getHeader(Lambda2Constants.RESOURCE_ARN, String.class);
+                builder.resource(resource);
+            } else {
+                throw new IllegalArgumentException("The resource ARN must be specified");
+            }
+            if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(Lambda2Constants.RESOURCE_TAG_KEYS))) {
+                List<String> tagKeys = exchange.getIn().getHeader(Lambda2Constants.RESOURCE_TAG_KEYS, List.class);
+                builder.tagKeys(tagKeys);
+            } else {
+                throw new IllegalArgumentException("The tag keys must be specified");
+            }
+            request = builder.build();
         }
         try {
-                result = lambdaClient.untagResource(request);
-            } catch (AwsServiceException ase) {
-                LOG.trace("untagResource command returned the error code {}", ase.awsErrorDetails().errorCode());
-                throw ase;
-            }
-            Message message = getMessageForResponse(exchange);
-            message.setBody(result);
+            result = lambdaClient.untagResource(request);
+        } catch (AwsServiceException ase) {
+            LOG.trace("untagResource command returned the error code {}", ase.awsErrorDetails().errorCode());
+            throw ase;
+        }
+        Message message = getMessageForResponse(exchange);
+        message.setBody(result);
     }
 
     private void publishVersion(LambdaClient lambdaClient, Exchange exchange) throws InvalidPayloadException {