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 0f0f3a39fafb7d176d685101f2a674f6ea327152 Author: Andrea Cosentino <[email protected]> AuthorDate: Tue Nov 17 13:56:32 2020 +0100 CAMEL-15836 - Camel-AWS2-SES: enable autowire on the SES Client --- .../apache/camel/component/aws2/ses/Ses2Component.java | 18 ------------------ .../camel/component/aws2/ses/Ses2Configuration.java | 15 +-------------- 2 files changed, 1 insertion(+), 32 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 0175553..9c31332 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 @@ -60,9 +60,6 @@ public class Ses2Component extends DefaultComponent { configuration.setFrom(remaining); Ses2Endpoint endpoint = new Ses2Endpoint(uri, this, configuration); setProperties(endpoint, parameters); - if (endpoint.getConfiguration().isAutoDiscoverClient()) { - checkAndSetRegistryClient(configuration, endpoint); - } if (configuration.getAmazonSESClient() == null && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) { throw new IllegalArgumentException("AmazonSESClient or accessKey and secretKey must be specified"); @@ -81,19 +78,4 @@ public class Ses2Component extends DefaultComponent { public void setConfiguration(Ses2Configuration configuration) { this.configuration = configuration; } - - 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"); - } - } } diff --git a/components/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Configuration.java b/components/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Configuration.java index 61d0e42..ced6e85 100644 --- a/components/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Configuration.java +++ b/components/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Configuration.java @@ -34,6 +34,7 @@ public class Ses2Configuration implements Cloneable { @Metadata(required = true) private String from; @UriParam + @Metadata(autowired = true) private SesClient amazonSESClient; @UriParam(label = "security", secret = true) private String accessKey; @@ -57,8 +58,6 @@ public class Ses2Configuration implements Cloneable { private String region; @UriParam(defaultValue = "false") private boolean trustAllCertificates; - @UriParam(label = "common", defaultValue = "true") - private boolean autoDiscoverClient = true; public String getAccessKey() { return accessKey; @@ -216,18 +215,6 @@ public class Ses2Configuration implements Cloneable { this.trustAllCertificates = trustAllCertificates; } - public boolean isAutoDiscoverClient() { - return autoDiscoverClient; - } - - /** - * Setting the autoDiscoverClient mechanism, if true, the component will look for a client instance in the registry - * automatically otherwise it will skip that checking. - */ - public void setAutoDiscoverClient(boolean autoDiscoverClient) { - this.autoDiscoverClient = autoDiscoverClient; - } - // ************************************************* // // *************************************************
