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/12 09:55:02 UTC

[camel] branch master updated (c0ed646 -> d9a382c)

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 c0ed646  Camel-AWS2-SES: Fixed CS
     new a383193  CAMEL-14690 - Camel-AWS2: Better logging when checking client instance in the registry, MQ
     new d9a382c  Camel-AWS2-MQ: 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/mq/MQ2Component.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, MQ

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 a38319381c44e9e798c643abdcaf163ccefd8ca5
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Mar 12 10:51:38 2020 +0100

    CAMEL-14690 - Camel-AWS2: Better logging when checking client instance in the registry, MQ
---
 .../camel/component/aws2/mq/MQ2Component.java      | 26 +++++++++++++++++-----
 1 file changed, 20 insertions(+), 6 deletions(-)

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


[camel] 02/02: Camel-AWS2-MQ: 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 d9a382c3def626b1134b60af1a1381a0372c323a
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Mar 12 10:54:01 2020 +0100

    Camel-AWS2-MQ: Fixed CS
---
 .../src/main/java/org/apache/camel/component/aws2/mq/MQ2Component.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/components/camel-aws2-mq/src/main/java/org/apache/camel/component/aws2/mq/MQ2Component.java b/components/camel-aws2-mq/src/main/java/org/apache/camel/component/aws2/mq/MQ2Component.java
index 2b52536..b488b4a 100644
--- a/components/camel-aws2-mq/src/main/java/org/apache/camel/component/aws2/mq/MQ2Component.java
+++ b/components/camel-aws2-mq/src/main/java/org/apache/camel/component/aws2/mq/MQ2Component.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.mq.MqClient;
 
 /**
@@ -35,7 +34,7 @@ import software.amazon.awssdk.services.mq.MqClient;
  */
 @Component("aws2-mq")
 public class MQ2Component extends DefaultComponent {
-	
+
     private static final Logger LOG = LoggerFactory.getLogger(MQ2Component.class);
     
     @Metadata