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:46:19 UTC

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

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 f558f46  Camel-AWS2-SNS: Fixed CS
     new 607b300  CAMEL-14690 - Camel-AWS2: Better logging when checking client instance in the registry, SES
     new c0ed646  Camel-AWS2-SES: 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/ses/Ses2Component.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, SES

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 607b30085b6f68b23574c65f8e91aa0e38fea057
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Mar 12 10:45:20 2020 +0100

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

diff --git a/components/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Component.java b/components/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Component.java
index 8a7039a..0e5c576 100644
--- a/components/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Component.java
+++ b/components/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Component.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.ses.SesClient;
 
 /**
@@ -32,6 +36,8 @@ import software.amazon.awssdk.services.ses.SesClient;
 @Component("aws2-ses")
 public class Ses2Component extends DefaultComponent {
 
+    private static final Logger LOG = LoggerFactory.getLogger(Ses2Component.class);
+    
     @Metadata
     private Ses2Configuration configuration = new Ses2Configuration();
 
@@ -55,7 +61,7 @@ public class Ses2Component extends DefaultComponent {
         configuration.setFrom(remaining);
         Ses2Endpoint endpoint = new Ses2Endpoint(uri, this, configuration);
         setProperties(endpoint, parameters);
-        checkAndSetRegistryClient(configuration);
+        checkAndSetRegistryClient(configuration, endpoint);
         if (configuration.getAmazonSESClient() == null && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) {
             throw new IllegalArgumentException("AmazonSESClient or accessKey and secretKey must be specified");
         }
@@ -74,10 +80,18 @@ public class Ses2Component extends DefaultComponent {
         this.configuration = configuration;
     }
 
-    private void checkAndSetRegistryClient(Ses2Configuration configuration) {
-        Set<SesClient> clients = getCamelContext().getRegistry().findByType(SesClient.class);
-        if (clients.size() == 1) {
-            configuration.setAmazonSESClient(clients.stream().findFirst().get());
+    private void checkAndSetRegistryClient(Ses2Configuration configuration, Ses2Endpoint endpoint) {
+        if (ObjectHelper.isEmpty(endpoint.getConfiguration().getAmazonSESClient())) {
+            LOG.debug("Looking for an SesClient instance in the registry");
+            Set<SesClient> clients = getCamelContext().getRegistry().findByType(SesClient.class);
+            if (clients.size() == 1) {
+                LOG.debug("Found exactly one SesClient instance in the registry");
+                configuration.setAmazonSESClient(clients.stream().findFirst().get());
+            } else {
+                LOG.debug("No SesClient instance in the registry");
+            }
+        } else {
+            LOG.debug("SesClient instance is already set at endpoint level: skipping the check in the registry");
         }
     }
 }


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

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

diff --git a/components/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Component.java b/components/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Component.java
index 0e5c576..0ebcb70 100644
--- a/components/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Component.java
+++ b/components/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Component.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.ses.SesClient;
 
 /**