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 2015/08/01 10:17:12 UTC
camel git commit: CAMEL-9044 aws-sns - Make it easier to configure
http proxy
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 <an...@gmail.com>
Authored: Sat Aug 1 10:12:38 2015 +0200
Committer: Andrea Cosentino <an...@gmail.com>
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