Repository: camel Updated Branches: refs/heads/master 2e2df2cb7 -> 9524f5572
CAMEL-11703 - Camel-AWS: Use builders instead of different constructors - AWS SWF Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9524f557 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9524f557 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9524f557 Branch: refs/heads/master Commit: 9524f5572b44a418e2ec9bdf575e4e0ec200d3f8 Parents: 2bf1159 Author: Andrea Cosentino <[email protected]> Authored: Fri Aug 25 09:33:16 2017 +0200 Committer: Andrea Cosentino <[email protected]> Committed: Fri Aug 25 09:33:29 2017 +0200 ---------------------------------------------------------------------- .../org/apache/camel/component/aws/swf/SWFEndpoint.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/9524f557/components/camel-aws/src/main/java/org/apache/camel/component/aws/swf/SWFEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/swf/SWFEndpoint.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/swf/SWFEndpoint.java index b34db2e..93a6a7a 100644 --- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/swf/SWFEndpoint.java +++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/swf/SWFEndpoint.java @@ -18,8 +18,12 @@ package org.apache.camel.component.aws.swf; import com.amazonaws.ClientConfiguration; import com.amazonaws.auth.AWSCredentials; +import com.amazonaws.auth.AWSCredentialsProvider; +import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.auth.BasicAWSCredentials; +import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflow; import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient; +import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClientBuilder; import com.amazonaws.services.simpleworkflow.flow.StartWorkflowOptions; import org.apache.camel.Consumer; import org.apache.camel.Exchange; @@ -71,7 +75,7 @@ public class SWFEndpoint extends DefaultEndpoint { @Override protected void doStart() throws Exception { if (configuration.getAmazonSWClient() == null) { - amazonSWClient = createSWClient(); + amazonSWClient = (AmazonSimpleWorkflowClient) createSWClient(); } super.doStart(); } @@ -89,15 +93,16 @@ public class SWFEndpoint extends DefaultEndpoint { return configuration.getAmazonSWClient() != null ? configuration.getAmazonSWClient() : amazonSWClient; } - private AmazonSimpleWorkflowClient createSWClient() throws Exception { + private AmazonSimpleWorkflow createSWClient() throws Exception { AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey()); + AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials); ClientConfiguration clientConfiguration = new ClientConfiguration(); if (!configuration.getClientConfigurationParameters().isEmpty()) { setProperties(clientConfiguration, configuration.getClientConfigurationParameters()); } - AmazonSimpleWorkflowClient client = new AmazonSimpleWorkflowClient(credentials, clientConfiguration); + AmazonSimpleWorkflow client = AmazonSimpleWorkflowClientBuilder.standard().withClientConfiguration(clientConfiguration).withCredentials(credentialsProvider).build(); if (!configuration.getSWClientParameters().isEmpty()) { setProperties(client, configuration.getSWClientParameters()); }
