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/11 10:46:34 UTC
[camel] branch master updated (9e93c62 -> 1374847)
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 9e93c62 CAMEL-14690 - Fixed logging for DDB
new 7c93c5d CAMEL-14690 - Camel-AWS2: Better logging when checking client instance in the registry, EC2
new 1374847 Camel-AWS2-EC2: 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:
.../camel/component/aws2/ec2/AWS2EC2Component.java | 23 +++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
[camel] 01/02: CAMEL-14690 - Camel-AWS2: Better logging when
checking client instance in the registry, EC2
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 7c93c5de3ed6afa0433ef832a5b25581c0056259
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Mar 11 11:45:41 2020 +0100
CAMEL-14690 - Camel-AWS2: Better logging when checking client instance in the registry, EC2
---
.../camel/component/aws2/ec2/AWS2EC2Component.java | 24 +++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/components/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Component.java b/components/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Component.java
index 2f8c3cb..dd6de4c 100644
--- a/components/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Component.java
+++ b/components/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Component.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.ec2.Ec2Client;
/**
@@ -32,6 +36,8 @@ import software.amazon.awssdk.services.ec2.Ec2Client;
@Component("aws2-ec2")
public class AWS2EC2Component extends DefaultComponent {
+ private static final Logger LOG = LoggerFactory.getLogger(AWS2EC2Component.class);
+
@Metadata
private AWS2EC2Configuration configuration = new AWS2EC2Configuration();
@@ -51,7 +57,7 @@ public class AWS2EC2Component extends DefaultComponent {
AWS2EC2Configuration configuration = this.configuration != null ? this.configuration.copy() : new AWS2EC2Configuration();
AWS2EC2Endpoint endpoint = new AWS2EC2Endpoint(uri, this, configuration);
setProperties(endpoint, parameters);
- checkAndSetRegistryClient(configuration);
+ checkAndSetRegistryClient(configuration, endpoint);
if (configuration.getAmazonEc2Client() == null && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) {
throw new IllegalArgumentException("amazonEC2Client or accessKey and secretKey must be specified");
}
@@ -70,10 +76,18 @@ public class AWS2EC2Component extends DefaultComponent {
this.configuration = configuration;
}
- private void checkAndSetRegistryClient(AWS2EC2Configuration configuration) {
- Set<Ec2Client> clients = getCamelContext().getRegistry().findByType(Ec2Client.class);
- if (clients.size() == 1) {
- configuration.setAmazonEc2Client(clients.stream().findFirst().get());
+ private void checkAndSetRegistryClient(AWS2EC2Configuration configuration, AWS2EC2Endpoint endpoint) {
+ if (ObjectHelper.isEmpty(endpoint.getConfiguration().getAmazonEc2Client())) {
+ LOG.debug("Looking for an Ec2Client instance in the registry");
+ Set<Ec2Client> clients = getCamelContext().getRegistry().findByType(Ec2Client.class);
+ if (clients.size() == 1) {
+ LOG.debug("Found exactly one Ec2Client instance in the registry");
+ configuration.setAmazonEc2Client(clients.stream().findFirst().get());
+ } else {
+ LOG.debug("No Ec2Client instance in the registry");
+ }
+ } else {
+ LOG.debug("Ec2Client instance is already set at endpoint level: skipping the check in the registry");
}
}
}
[camel] 02/02: Camel-AWS2-EC2: 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 1374847c4683e85bb990707eb22d05cdfee2fc1f
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Mar 11 11:46:04 2020 +0100
Camel-AWS2-EC2: Fixed CS
---
.../main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Component.java | 1 -
1 file changed, 1 deletion(-)
diff --git a/components/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Component.java b/components/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Component.java
index dd6de4c..e030750 100644
--- a/components/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Component.java
+++ b/components/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Component.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.ec2.Ec2Client;
/**