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 2020/03/10 15:35:09 UTC
[camel] branch master updated (34b3ddb -> 47b6ccc)
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 34b3ddb Camel-AWS2-Lambda: Fixed CS
new df1edfb CAMEL-14690 - Camel-AWS2: Better logging when checking client instance in the registry, Lambda
new 47b6ccc Camel-AWS2-Lambda: 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/Lambda2Component.java | 23 +++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
[camel] 02/02: Camel-AWS2-Lambda: 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 47b6ccc8d81610761471efce2f4a40526de14772
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Mar 10 16:33:29 2020 +0100
Camel-AWS2-Lambda: Fixed CS
---
.../java/org/apache/camel/component/aws2/lambda/Lambda2Component.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/components/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Component.java b/components/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Component.java
index f5cc874..a61608d 100644
--- a/components/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Component.java
+++ b/components/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Component.java
@@ -27,7 +27,6 @@ import org.apache.camel.support.DefaultComponent;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import software.amazon.awssdk.services.lambda.LambdaClient;
/**
@@ -35,7 +34,7 @@ import software.amazon.awssdk.services.lambda.LambdaClient;
*/
@Component("aws2-lambda")
public class Lambda2Component extends DefaultComponent {
-
+
private static final Logger LOG = LoggerFactory.getLogger(Lambda2Component.class);
@Metadata
[camel] 01/02: CAMEL-14690 - Camel-AWS2: Better logging when
checking client instance in the registry, Lambda
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 df1edfb1785084fb6d10a8de4feb1ff06925f5c1
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Mar 10 16:30:47 2020 +0100
CAMEL-14690 - Camel-AWS2: Better logging when checking client instance in the registry, Lambda
---
.../component/aws2/lambda/Lambda2Component.java | 24 +++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/components/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Component.java b/components/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Component.java
index a86b8d4..f5cc874 100644
--- a/components/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Component.java
+++ b/components/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Component.java
@@ -24,6 +24,10 @@ import org.apache.camel.Endpoint;
import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.annotations.Component;
import org.apache.camel.support.DefaultComponent;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import software.amazon.awssdk.services.lambda.LambdaClient;
/**
@@ -31,6 +35,8 @@ import software.amazon.awssdk.services.lambda.LambdaClient;
*/
@Component("aws2-lambda")
public class Lambda2Component extends DefaultComponent {
+
+ private static final Logger LOG = LoggerFactory.getLogger(Lambda2Component.class);
@Metadata
private Lambda2Configuration configuration = new Lambda2Configuration();
@@ -51,7 +57,7 @@ public class Lambda2Component extends DefaultComponent {
Lambda2Endpoint endpoint = new Lambda2Endpoint(uri, this, configuration);
setProperties(endpoint, parameters);
endpoint.setFunction(remaining);
- checkAndSetRegistryClient(configuration);
+ checkAndSetRegistryClient(configuration, endpoint);
if (configuration.getAwsLambdaClient() == null && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) {
throw new IllegalArgumentException("accessKey/secretKey or awsLambdaClient must be specified");
}
@@ -70,10 +76,18 @@ public class Lambda2Component extends DefaultComponent {
this.configuration = configuration;
}
- private void checkAndSetRegistryClient(Lambda2Configuration configuration) {
- Set<LambdaClient> clients = getCamelContext().getRegistry().findByType(LambdaClient.class);
- if (clients.size() == 1) {
- configuration.setAwsLambdaClient(clients.stream().findFirst().get());
+ private void checkAndSetRegistryClient(Lambda2Configuration configuration, Lambda2Endpoint endpoint) {
+ if (ObjectHelper.isEmpty(endpoint.getConfiguration().getAwsLambdaClient())) {
+ LOG.debug("Looking for an LambdaClient instance in the registry");
+ Set<LambdaClient> clients = getCamelContext().getRegistry().findByType(LambdaClient.class);
+ if (clients.size() == 1) {
+ LOG.debug("Found exactly one LambdaClient instance in the registry");
+ configuration.setAwsLambdaClient(clients.stream().findFirst().get());
+ } else {
+ LOG.debug("No LambdaClient instance in the registry");
+ }
+ } else {
+ LOG.debug("LambdaClient instance is already set at endpoint level: skipping the check in the registry");
}
}
}