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:40:00 UTC

[camel] branch master updated (7485e8a -> 9e93c62)

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 7485e8a  CAMEL-14690 - Camel-AWS2: Better logging when checking client instance in the registry, CloudWatch
     new db99931  CAMEL-14690 - Camel-AWS2: Better logging when checking client instance in the registry, DynamoDB
     new 40c5139  CAMEL-14690 - Camel-AWS2: Better logging when checking client instance in the registry, DynamoDBStreams
     new 7c63b10  Camel-AWS2-DDB: Fixed CS
     new 9e93c62  CAMEL-14690 - Fixed logging for DDB

The 4 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/ddb/Ddb2Component.java    | 23 +++++++++++++++++-----
 .../aws2/ddbstream/Ddb2StreamComponent.java        | 23 +++++++++++++++++-----
 2 files changed, 36 insertions(+), 10 deletions(-)


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

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 40c5139b29332acf4faf1dc23df5fd6a52c3676b
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Mar 11 11:38:16 2020 +0100

    CAMEL-14690 - Camel-AWS2: Better logging when checking client instance in the registry, DynamoDBStreams
---
 .../aws2/ddbstream/Ddb2StreamComponent.java        | 26 +++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamComponent.java b/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamComponent.java
index 5c20951..0c48318 100644
--- a/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamComponent.java
+++ b/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamComponent.java
@@ -21,13 +21,21 @@ import java.util.Set;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
+import org.apache.camel.component.aws2.ddb.Ddb2Component;
 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.dynamodb.DynamoDbClient;
 import software.amazon.awssdk.services.dynamodb.streams.DynamoDbStreamsClient;
 
 @Component("aws2-ddbstream")
 public class Ddb2StreamComponent extends DefaultComponent {
+	
+    private static final Logger LOG = LoggerFactory.getLogger(Ddb2StreamComponent.class);
 
     @Metadata
     private Ddb2StreamConfiguration configuration = new Ddb2StreamConfiguration();
@@ -52,7 +60,7 @@ public class Ddb2StreamComponent extends DefaultComponent {
         configuration.setTableName(remaining);
         Ddb2StreamEndpoint endpoint = new Ddb2StreamEndpoint(uri, configuration, this);
         setProperties(endpoint, parameters);
-        checkAndSetRegistryClient(configuration);
+        checkAndSetRegistryClient(configuration, endpoint);
         if (configuration.getAmazonDynamoDbStreamsClient() == null && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) {
             throw new IllegalArgumentException("amazonDDBStreamsClient or accessKey and secretKey must be specified");
         }
@@ -70,10 +78,18 @@ public class Ddb2StreamComponent extends DefaultComponent {
         this.configuration = configuration;
     }
 
-    private void checkAndSetRegistryClient(Ddb2StreamConfiguration configuration) {
-        Set<DynamoDbStreamsClient> clients = getCamelContext().getRegistry().findByType(DynamoDbStreamsClient.class);
-        if (clients.size() == 1) {
-            configuration.setAmazonDynamoDbStreamsClient(clients.stream().findFirst().get());
+    private void checkAndSetRegistryClient(Ddb2StreamConfiguration configuration, Ddb2StreamEndpoint endpoint) {
+        if (ObjectHelper.isEmpty(endpoint.getConfiguration().getAmazonDynamoDbStreamsClient())) {
+            LOG.debug("Looking for an DynamoDbStreamsClient instance in the registry");
+            Set<DynamoDbStreamsClient> clients = getCamelContext().getRegistry().findByType(DynamoDbStreamsClient.class);
+            if (clients.size() == 1) {
+                LOG.debug("Found exactly one DynamoDbStreamsClient instance in the registry");
+                configuration.setAmazonDynamoDbStreamsClient(clients.stream().findFirst().get());
+            } else {
+                LOG.debug("No DynamoDbStreamsClient instance in the registry");
+            }
+        } else {
+            LOG.debug("DynamoDbStreamsClient instance is already set at endpoint level: skipping the check in the registry");
         }
     }
 }


[camel] 03/04: Camel-AWS2-DDB: 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 7c63b10361f2f783539dc568d1da949cd8f1be49
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Mar 11 11:39:10 2020 +0100

    Camel-AWS2-DDB: Fixed CS
---
 .../main/java/org/apache/camel/component/aws2/ddb/Ddb2Component.java | 2 +-
 .../apache/camel/component/aws2/ddbstream/Ddb2StreamComponent.java   | 5 +----
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Component.java b/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Component.java
index abb8578..0316189 100644
--- a/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Component.java
+++ b/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Component.java
@@ -31,7 +31,7 @@ import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
 
 @Component("aws2-ddb")
 public class Ddb2Component extends DefaultComponent {
-	
+
     private static final Logger LOG = LoggerFactory.getLogger(Ddb2Component.class);
 
     @Metadata
diff --git a/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamComponent.java b/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamComponent.java
index 0c48318..9977485 100644
--- a/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamComponent.java
+++ b/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamComponent.java
@@ -21,20 +21,17 @@ import java.util.Set;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
-import org.apache.camel.component.aws2.ddb.Ddb2Component;
 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.dynamodb.DynamoDbClient;
 import software.amazon.awssdk.services.dynamodb.streams.DynamoDbStreamsClient;
 
 @Component("aws2-ddbstream")
 public class Ddb2StreamComponent extends DefaultComponent {
-	
+
     private static final Logger LOG = LoggerFactory.getLogger(Ddb2StreamComponent.class);
 
     @Metadata


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

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 db9993116ee350a6d9a108fd359d34c46372cbd5
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Mar 11 11:33:51 2020 +0100

    CAMEL-14690 - Camel-AWS2: Better logging when checking client instance in the registry, DynamoDB
---
 .../camel/component/aws2/ddb/Ddb2Component.java    | 23 +++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Component.java b/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Component.java
index a56bafa..abb8578 100644
--- a/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Component.java
+++ b/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Component.java
@@ -24,10 +24,15 @@ 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.dynamodb.DynamoDbClient;
 
 @Component("aws2-ddb")
 public class Ddb2Component extends DefaultComponent {
+	
+    private static final Logger LOG = LoggerFactory.getLogger(Ddb2Component.class);
 
     @Metadata
     private Ddb2Configuration configuration = new Ddb2Configuration();
@@ -52,7 +57,7 @@ public class Ddb2Component extends DefaultComponent {
         configuration.setTableName(remaining);
         Ddb2Endpoint endpoint = new Ddb2Endpoint(uri, this, configuration);
         setProperties(endpoint, parameters);
-        checkAndSetRegistryClient(configuration);
+        checkAndSetRegistryClient(configuration, endpoint);
         if (configuration.getAmazonDDBClient() == null && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) {
             throw new IllegalArgumentException("amazonDDBClient or accessKey and secretKey must be specified");
         }
@@ -71,10 +76,18 @@ public class Ddb2Component extends DefaultComponent {
         this.configuration = configuration;
     }
 
-    private void checkAndSetRegistryClient(Ddb2Configuration configuration) {
-        Set<DynamoDbClient> clients = getCamelContext().getRegistry().findByType(DynamoDbClient.class);
-        if (clients.size() == 1) {
-            configuration.setAmazonDDBClient(clients.stream().findFirst().get());
+    private void checkAndSetRegistryClient(Ddb2Configuration configuration, Ddb2Endpoint endpoint) {
+        if (ObjectHelper.isEmpty(endpoint.getConfiguration().getAmazonDDBClient())) {
+            LOG.debug("Looking for an CloudWatchClient instance in the registry");
+            Set<DynamoDbClient> clients = getCamelContext().getRegistry().findByType(DynamoDbClient.class);
+            if (clients.size() == 1) {
+                LOG.debug("Found exactly one CloudWatchClient instance in the registry");
+                configuration.setAmazonDDBClient(clients.stream().findFirst().get());
+            } else {
+                LOG.debug("No CloudWatchClient instance in the registry");
+            }
+        } else {
+            LOG.debug("CloudWatchClient instance is already set at endpoint level: skipping the check in the registry");
         }
     }
 }


[camel] 04/04: CAMEL-14690 - Fixed logging for DDB

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

    CAMEL-14690 - Fixed logging for DDB
---
 .../java/org/apache/camel/component/aws2/ddb/Ddb2Component.java   | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Component.java b/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Component.java
index 0316189..a84b652 100644
--- a/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Component.java
+++ b/components/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Component.java
@@ -78,16 +78,16 @@ public class Ddb2Component extends DefaultComponent {
 
     private void checkAndSetRegistryClient(Ddb2Configuration configuration, Ddb2Endpoint endpoint) {
         if (ObjectHelper.isEmpty(endpoint.getConfiguration().getAmazonDDBClient())) {
-            LOG.debug("Looking for an CloudWatchClient instance in the registry");
+            LOG.debug("Looking for an DynamoDbClient instance in the registry");
             Set<DynamoDbClient> clients = getCamelContext().getRegistry().findByType(DynamoDbClient.class);
             if (clients.size() == 1) {
-                LOG.debug("Found exactly one CloudWatchClient instance in the registry");
+                LOG.debug("Found exactly one DynamoDbClient instance in the registry");
                 configuration.setAmazonDDBClient(clients.stream().findFirst().get());
             } else {
-                LOG.debug("No CloudWatchClient instance in the registry");
+                LOG.debug("No DynamoDbClient instance in the registry");
             }
         } else {
-            LOG.debug("CloudWatchClient instance is already set at endpoint level: skipping the check in the registry");
+            LOG.debug("DynamoDbClient instance is already set at endpoint level: skipping the check in the registry");
         }
     }
 }