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 15:49:07 UTC
[camel] branch master updated (6ba09ac -> 92758d6)
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 6ba09ac Camel-AWS2-IAM: Fixed CS
new 14024db CAMEL-14690 - Camel-AWS2: Better logging when checking client instance in the registry, SQS
new 92758d6 Camel-AWS-SQS: 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/sqs/Sqs2Component.java | 23 +++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
[camel] 02/02: Camel-AWS-SQS: 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 92758d674702fda4f8ff28381669fee93dc5af3c
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Mar 11 16:47:46 2020 +0100
Camel-AWS-SQS: Fixed CS
---
.../src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Component.java | 1 -
1 file changed, 1 deletion(-)
diff --git a/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Component.java b/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Component.java
index 5375893..26d3bca 100644
--- a/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Component.java
+++ b/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Component.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.regions.Region;
import software.amazon.awssdk.services.sqs.SqsClient;
[camel] 01/02: CAMEL-14690 - Camel-AWS2: Better logging when
checking client instance in the registry, SQS
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 14024dbd81c0a1498fde743bc05dc3ad80fd0a99
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Mar 11 16:44:21 2020 +0100
CAMEL-14690 - Camel-AWS2: Better logging when checking client instance in the registry, SQS
---
.../camel/component/aws2/sqs/Sqs2Component.java | 24 +++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Component.java b/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Component.java
index c49883e..5375893 100644
--- a/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Component.java
+++ b/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Component.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.regions.Region;
import software.amazon.awssdk.services.sqs.SqsClient;
@@ -33,6 +37,8 @@ import software.amazon.awssdk.services.sqs.SqsClient;
@Component("aws2-sqs")
public class Sqs2Component extends DefaultComponent {
+ private static final Logger LOG = LoggerFactory.getLogger(Sqs2Component.class);
+
@Metadata
private Sqs2Configuration configuration = new Sqs2Configuration();
@@ -66,7 +72,7 @@ public class Sqs2Component extends DefaultComponent {
}
Sqs2Endpoint sqsEndpoint = new Sqs2Endpoint(uri, this, configuration);
setProperties(sqsEndpoint, parameters);
- checkAndSetRegistryClient(configuration);
+ checkAndSetRegistryClient(configuration, sqsEndpoint);
if (configuration.getAmazonSQSClient() == null && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) {
throw new IllegalArgumentException("AmazonSQSClient or accessKey and secretKey must be specified.");
}
@@ -90,10 +96,18 @@ public class Sqs2Component extends DefaultComponent {
this.configuration = configuration;
}
- private void checkAndSetRegistryClient(Sqs2Configuration configuration) {
- Set<SqsClient> clients = getCamelContext().getRegistry().findByType(SqsClient.class);
- if (clients.size() == 1) {
- configuration.setAmazonSQSClient(clients.stream().findFirst().get());
+ private void checkAndSetRegistryClient(Sqs2Configuration configuration, Sqs2Endpoint endpoint) {
+ if (ObjectHelper.isEmpty(endpoint.getConfiguration().getAmazonSQSClient())) {
+ LOG.debug("Looking for an SqsClient instance in the registry");
+ Set<SqsClient> clients = getCamelContext().getRegistry().findByType(SqsClient.class);
+ if (clients.size() == 1) {
+ LOG.debug("Found exactly one SqsClient instance in the registry");
+ configuration.setAmazonSQSClient(clients.stream().findFirst().get());
+ } else {
+ LOG.debug("No SqsClient instance in the registry");
+ }
+ } else {
+ LOG.debug("SqsClient instance is already set at endpoint level: skipping the check in the registry");
}
}
}