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:50:31 UTC

[camel] branch master updated (1374847 -> f23a444)

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 1374847  Camel-AWS2-EC2: Fixed CS
     new 27b3af5  CAMEL-14690 - Camel-AWS2: Better logging when checking client instance in the registry, ECS
     new f23a444  Camel-AWS2-ECS: 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/ecs/ECS2Component.java    | 23 +++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)


[camel] 02/02: Camel-AWS2-ECS: 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 f23a44427383be95abd32082512b5e06dbafcfa3
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Mar 11 11:50:06 2020 +0100

    Camel-AWS2-ECS: Fixed CS
---
 .../src/main/java/org/apache/camel/component/aws2/ecs/ECS2Component.java | 1 -
 1 file changed, 1 deletion(-)

diff --git a/components/camel-aws2-ecs/src/main/java/org/apache/camel/component/aws2/ecs/ECS2Component.java b/components/camel-aws2-ecs/src/main/java/org/apache/camel/component/aws2/ecs/ECS2Component.java
index e7cbe52..b5c0529 100644
--- a/components/camel-aws2-ecs/src/main/java/org/apache/camel/component/aws2/ecs/ECS2Component.java
+++ b/components/camel-aws2-ecs/src/main/java/org/apache/camel/component/aws2/ecs/ECS2Component.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.ecs.EcsClient;
 
 /**


[camel] 01/02: CAMEL-14690 - Camel-AWS2: Better logging when checking client instance in the registry, ECS

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 27b3af5a7098afd790a08fb7f19b13894b2a430b
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Mar 11 11:49:39 2020 +0100

    CAMEL-14690 - Camel-AWS2: Better logging when checking client instance in the registry, ECS
---
 .../camel/component/aws2/ecs/ECS2Component.java    | 24 +++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/components/camel-aws2-ecs/src/main/java/org/apache/camel/component/aws2/ecs/ECS2Component.java b/components/camel-aws2-ecs/src/main/java/org/apache/camel/component/aws2/ecs/ECS2Component.java
index 8c05af1..e7cbe52 100644
--- a/components/camel-aws2-ecs/src/main/java/org/apache/camel/component/aws2/ecs/ECS2Component.java
+++ b/components/camel-aws2-ecs/src/main/java/org/apache/camel/component/aws2/ecs/ECS2Component.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.ecs.EcsClient;
 
 /**
@@ -32,6 +36,8 @@ import software.amazon.awssdk.services.ecs.EcsClient;
 @Component("aws2-ecs")
 public class ECS2Component extends DefaultComponent {
 
+    private static final Logger LOG = LoggerFactory.getLogger(ECS2Component.class);
+    
     @Metadata
     private ECS2Configuration configuration = new ECS2Configuration();
 
@@ -50,7 +56,7 @@ public class ECS2Component extends DefaultComponent {
         ECS2Configuration configuration = this.configuration != null ? this.configuration.copy() : new ECS2Configuration();
         ECS2Endpoint endpoint = new ECS2Endpoint(uri, this, configuration);
         setProperties(endpoint, parameters);
-        checkAndSetRegistryClient(configuration);
+        checkAndSetRegistryClient(configuration, endpoint);
         if (configuration.getEcsClient() == null && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) {
             throw new IllegalArgumentException("Amazon ecs client or accessKey and secretKey must be specified");
         }
@@ -69,10 +75,18 @@ public class ECS2Component extends DefaultComponent {
         this.configuration = configuration;
     }
 
-    private void checkAndSetRegistryClient(ECS2Configuration configuration) {
-        Set<EcsClient> clients = getCamelContext().getRegistry().findByType(EcsClient.class);
-        if (clients.size() == 1) {
-            configuration.setEcsClient(clients.stream().findFirst().get());
+    private void checkAndSetRegistryClient(ECS2Configuration configuration, ECS2Endpoint endpoint) {
+        if (ObjectHelper.isEmpty(endpoint.getConfiguration().getEcsClient())) {
+            LOG.debug("Looking for an EcsClient instance in the registry");
+            Set<EcsClient> clients = getCamelContext().getRegistry().findByType(EcsClient.class);
+            if (clients.size() == 1) {
+                LOG.debug("Found exactly one EcsClient instance in the registry");
+                configuration.setEcsClient(clients.stream().findFirst().get());
+            } else {
+                LOG.debug("No EcsClient instance in the registry");
+            }
+        } else {
+            LOG.debug("EcsClient instance is already set at endpoint level: skipping the check in the registry");
         }
     }
 }