Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0185818853 for ; Sat, 1 Aug 2015 08:17:13 +0000 (UTC) Received: (qmail 38197 invoked by uid 500); 1 Aug 2015 08:17:12 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 38152 invoked by uid 500); 1 Aug 2015 08:17:12 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 38143 invoked by uid 99); 1 Aug 2015 08:17:12 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 01 Aug 2015 08:17:12 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id ACA52DFBD3; Sat, 1 Aug 2015 08:17:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: acosentino@apache.org To: commits@camel.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: camel git commit: CAMEL-9044 aws-sns - Make it easier to configure http proxy Date: Sat, 1 Aug 2015 08:17:12 +0000 (UTC) Repository: camel Updated Branches: refs/heads/master d5dcb1bd3 -> 9ddeb2f0f CAMEL-9044 aws-sns - Make it easier to configure http proxy Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9ddeb2f0 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9ddeb2f0 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9ddeb2f0 Branch: refs/heads/master Commit: 9ddeb2f0fdcd75fc333b4da2c960cc1550db0443 Parents: d5dcb1b Author: Andrea Cosentino Authored: Sat Aug 1 10:12:38 2015 +0200 Committer: Andrea Cosentino Committed: Sat Aug 1 10:12:38 2015 +0200 ---------------------------------------------------------------------- .../component/aws/sns/SnsConfiguration.java | 29 ++++++++++++++++++++ .../camel/component/aws/sns/SnsEndpoint.java | 11 +++++++- 2 files changed, 39 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/9ddeb2f0/components/camel-aws/src/main/java/org/apache/camel/component/aws/sns/SnsConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sns/SnsConfiguration.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sns/SnsConfiguration.java index 08a3a81..f567643 100644 --- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sns/SnsConfiguration.java +++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sns/SnsConfiguration.java @@ -17,6 +17,7 @@ package org.apache.camel.component.aws.sns; import com.amazonaws.services.sns.AmazonSNS; + import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriParam; import org.apache.camel.spi.UriParams; @@ -38,6 +39,10 @@ public class SnsConfiguration implements Cloneable { private String secretKey; @UriParam private String amazonSNSEndpoint; + @UriParam + private String proxyHost; + @UriParam + private Integer proxyPort; // Producer only properties @UriParam @@ -145,6 +150,28 @@ public class SnsConfiguration implements Cloneable { public void setMessageStructure(String messageStructure) { this.messageStructure = messageStructure; } + + /** + * To define a proxy host when instantiating the SQS client + */ + public String getProxyHost() { + return proxyHost; + } + + public void setProxyHost(String proxyHost) { + this.proxyHost = proxyHost; + } + + /** + * To define a proxy port when instantiating the SQS client + */ + public Integer getProxyPort() { + return proxyPort; + } + + public void setProxyPort(Integer proxyPort) { + this.proxyPort = proxyPort; + } @Override public String toString() { @@ -156,6 +183,8 @@ public class SnsConfiguration implements Cloneable { + ", topicArn=" + topicArn + ", policy=" + policy + ", messageStructure=" + messageStructure + + ", proxyHost=" + proxyHost + + ", proxyPort=" + proxyPort + "]"; } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/9ddeb2f0/components/camel-aws/src/main/java/org/apache/camel/component/aws/sns/SnsEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sns/SnsEndpoint.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sns/SnsEndpoint.java index fc01216..b2dc4ce 100644 --- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sns/SnsEndpoint.java +++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sns/SnsEndpoint.java @@ -16,6 +16,7 @@ */ package org.apache.camel.component.aws.sns; +import com.amazonaws.ClientConfiguration; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.services.sns.AmazonSNS; @@ -125,8 +126,16 @@ public class SnsEndpoint extends DefaultEndpoint { * @return AmazonSNSClient */ AmazonSNS createSNSClient() { + AmazonSNS client = null; AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey()); - AmazonSNS client = new AmazonSNSClient(credentials); + if (ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort())) { + ClientConfiguration clientConfiguration = new ClientConfiguration(); + clientConfiguration.setProxyHost(configuration.getProxyHost()); + clientConfiguration.setProxyPort(configuration.getProxyPort()); + client = new AmazonSNSClient(credentials, clientConfiguration); + } else { + client = new AmazonSNSClient(credentials); + } return client; } } \ No newline at end of file