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/11/09 07:44:24 UTC
[camel] 01/03: CAMEL-15785 - Camel-AWS2: make possibile to use a
client based on DefaultCredentialProvider in all the interested components
- SQS Cleanup
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 998d682669baf434dc19983f30b7d4b7e175b241
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Nov 9 08:19:48 2020 +0100
CAMEL-15785 - Camel-AWS2: make possibile to use a client based on DefaultCredentialProvider in all the interested components - SQS Cleanup
---
.../camel/component/aws2/sqs/Sqs2Endpoint.java | 57 ----------------------
1 file changed, 57 deletions(-)
diff --git a/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Endpoint.java b/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Endpoint.java
index 5bba1b5..b42956d 100644
--- a/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Endpoint.java
+++ b/components/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Endpoint.java
@@ -345,9 +345,6 @@ public class Sqs2Endpoint extends ScheduledPollEndpoint implements HeaderFilterS
}
public SqsClient getClient() {
- if (client == null) {
- client = createClient();
- }
return client;
}
@@ -355,60 +352,6 @@ public class Sqs2Endpoint extends ScheduledPollEndpoint implements HeaderFilterS
this.client = client;
}
- /**
- * Provide the possibility to override this method for an mock implementation
- *
- * @return AmazonSQSClient
- */
- SqsClient createClient() {
- SqsClient client = null;
- SqsClientBuilder clientBuilder = SqsClient.builder();
- ProxyConfiguration.Builder proxyConfig = null;
- ApacheHttpClient.Builder httpClientBuilder = null;
- boolean isClientConfigFound = false;
- if (ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort())) {
- proxyConfig = ProxyConfiguration.builder();
- URI proxyEndpoint = URI.create(configuration.getProxyProtocol() + "://" + configuration.getProxyHost() + ":"
- + configuration.getProxyPort());
- proxyConfig.endpoint(proxyEndpoint);
- httpClientBuilder = ApacheHttpClient.builder().proxyConfiguration(proxyConfig.build());
- isClientConfigFound = true;
- }
- if (configuration.getAccessKey() != null && configuration.getSecretKey() != null) {
- AwsBasicCredentials cred = AwsBasicCredentials.create(configuration.getAccessKey(), configuration.getSecretKey());
- if (isClientConfigFound) {
- clientBuilder = clientBuilder.httpClientBuilder(httpClientBuilder)
- .credentialsProvider(StaticCredentialsProvider.create(cred));
- } else {
- clientBuilder = clientBuilder.credentialsProvider(StaticCredentialsProvider.create(cred));
- }
- } else {
- if (!isClientConfigFound) {
- clientBuilder = clientBuilder.httpClientBuilder(httpClientBuilder);
- }
- }
-
- if (!isDefaultAwsHost()) {
- String endpointOverrideUri = getAwsEndpointUri();
- clientBuilder.endpointOverride(URI.create(endpointOverrideUri));
- }
-
- if (ObjectHelper.isNotEmpty(configuration.getRegion())) {
- clientBuilder = clientBuilder.region(Region.of(configuration.getRegion()));
- }
- if (configuration.isTrustAllCertificates()) {
- SdkHttpClient ahc = ApacheHttpClient.builder().buildWithDefaults(AttributeMap
- .builder()
- .put(
- SdkHttpConfigurationOption.TRUST_ALL_CERTIFICATES,
- Boolean.TRUE)
- .build());
- clientBuilder.httpClient(ahc);
- }
- client = clientBuilder.build();
- return client;
- }
-
protected String getQueueUrl() {
return queueUrl;
}