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:26:55 UTC

[camel] branch master updated (9a812c1 -> f558f46)

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 9a812c1  Upgrade AWS SDK v2 to version 2.10.84
     new e6d4366  CAMEL-14690 - Camel-AWS2: Better logging when checking client instance in the registry, SNS
     new f558f46  Camel-AWS2-SNS: 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/sns/Sns2Component.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, SNS

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

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

diff --git a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Component.java b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Component.java
index d13c3c5..dc774c4 100644
--- a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Component.java
+++ b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Component.java
@@ -24,12 +24,18 @@ 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.regions.Region;
 import software.amazon.awssdk.services.sns.SnsClient;
 
 @Component("aws2-sns")
 public class Sns2Component extends DefaultComponent {
-
+	
+    private static final Logger LOG = LoggerFactory.getLogger(Sns2Component.class);
+    
     @Metadata
     private Sns2Configuration configuration = new Sns2Configuration();
 
@@ -62,7 +68,7 @@ public class Sns2Component extends DefaultComponent {
         }
         Sns2Endpoint endpoint = new Sns2Endpoint(uri, this, configuration);
         setProperties(endpoint, parameters);
-        checkAndSetRegistryClient(configuration);
+        checkAndSetRegistryClient(configuration, endpoint);
         if (configuration.getAmazonSNSClient() == null && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) {
             throw new IllegalArgumentException("AmazonSNSClient or accessKey and secretKey must be specified");
         }
@@ -81,10 +87,18 @@ public class Sns2Component extends DefaultComponent {
         this.configuration = configuration;
     }
 
-    private void checkAndSetRegistryClient(Sns2Configuration configuration) {
-        Set<SnsClient> clients = getCamelContext().getRegistry().findByType(SnsClient.class);
-        if (clients.size() == 1) {
-            configuration.setAmazonSNSClient(clients.stream().findFirst().get());
+    private void checkAndSetRegistryClient(Sns2Configuration configuration, Sns2Endpoint endpoint) {
+        if (ObjectHelper.isEmpty(endpoint.getConfiguration().getAmazonSNSClient())) {
+            LOG.debug("Looking for an SnsClient instance in the registry");
+            Set<SnsClient> clients = getCamelContext().getRegistry().findByType(SnsClient.class);
+            if (clients.size() == 1) {
+                LOG.debug("Found exactly one SnsClient instance in the registry");
+                configuration.setAmazonSNSClient(clients.stream().findFirst().get());
+            } else {
+                LOG.debug("No SnsClient instance in the registry");
+            }
+        } else {
+            LOG.debug("SnsClient instance is already set at endpoint level: skipping the check in the registry");
         }
     }
 }


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

    Camel-AWS2-SNS: Fixed CS
---
 .../main/java/org/apache/camel/component/aws2/sns/Sns2Component.java   | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Component.java b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Component.java
index dc774c4..614c5b6 100644
--- a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Component.java
+++ b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Component.java
@@ -27,13 +27,12 @@ import org.apache.camel.support.DefaultComponent;
 import org.apache.camel.util.ObjectHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import software.amazon.awssdk.regions.Region;
 import software.amazon.awssdk.services.sns.SnsClient;
 
 @Component("aws2-sns")
 public class Sns2Component extends DefaultComponent {
-	
+
     private static final Logger LOG = LoggerFactory.getLogger(Sns2Component.class);
     
     @Metadata