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/30 07:15:08 UTC

[camel] branch master updated (aef89a0 -> f47fb69)

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 aef89a0  Sync deps
     new 9a41683  Camel-AWS2-Lambda: Producer operations refactoring - getFunction
     new f47fb69  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     | 37 +++++++++-------------
 1 file changed, 15 insertions(+), 22 deletions(-)

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

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 9a41683b8870c6888a15e7910788e11a659c24ba
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Mar 30 09:10:54 2021 +0200

    Camel-AWS2-Lambda: Producer operations refactoring - getFunction
---
 .../component/aws2/lambda/Lambda2Producer.java     | 37 +++++++++-------------
 1 file changed, 15 insertions(+), 22 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 a291a2a..04b749a 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
@@ -152,31 +152,24 @@ public class Lambda2Producer extends DefaultProducer {
     }
 
     private void getFunction(LambdaClient lambdaClient, Exchange exchange) throws InvalidPayloadException {
+    	GetFunctionRequest request = null;
+    	GetFunctionResponse result;
         if (getConfiguration().isPojoRequest()) {
-            Object payload = exchange.getIn().getMandatoryBody();
-            if (payload instanceof GetFunctionRequest) {
-                GetFunctionResponse result;
-                try {
-                    result = lambdaClient.getFunction((GetFunctionRequest) payload);
-                } catch (AwsServiceException ase) {
-                    LOG.trace("getFunction command returned the error code {}", ase.awsErrorDetails().errorCode());
-                    throw ase;
-                }
-                Message message = getMessageForResponse(exchange);
-                message.setBody(result);
-            }
+            request = exchange.getIn().getMandatoryBody(GetFunctionRequest.class);
         } else {
-            GetFunctionResponse result;
-            try {
-                result = lambdaClient
-                        .getFunction(GetFunctionRequest.builder().functionName(getEndpoint().getFunction()).build());
-            } catch (AwsServiceException ase) {
-                LOG.trace("getFunction command returned the error code {}", ase.awsErrorDetails().errorCode());
-                throw ase;
-            }
-            Message message = getMessageForResponse(exchange);
-            message.setBody(result);
+            GetFunctionRequest.Builder builder = GetFunctionRequest.builder();
+            builder.functionName(getEndpoint().getFunction());
+            request = builder.build();
+        }
+        try {
+            result = lambdaClient
+                    .getFunction(request);
+        } catch (AwsServiceException ase) {
+            LOG.trace("getFunction command returned the error code {}", ase.awsErrorDetails().errorCode());
+            throw ase;
         }
+        Message message = getMessageForResponse(exchange);
+        message.setBody(result);
     }
 
     private void deleteFunction(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 f47fb69380159f505b6e60154107343dc6d9cc94
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Mar 30 09:14:26 2021 +0200

    Fixed CS
---
 .../java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 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 04b749a..8f42fad 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
@@ -152,8 +152,8 @@ public class Lambda2Producer extends DefaultProducer {
     }
 
     private void getFunction(LambdaClient lambdaClient, Exchange exchange) throws InvalidPayloadException {
-    	GetFunctionRequest request = null;
-    	GetFunctionResponse result;
+        GetFunctionRequest request = null;
+        GetFunctionResponse result;
         if (getConfiguration().isPojoRequest()) {
             request = exchange.getIn().getMandatoryBody(GetFunctionRequest.class);
         } else {