Repository: camel
Updated Branches:
  refs/heads/camel-2.15.x dd0832794 -> 79c5ed6a7


CAMEL-8598: Set default timeouts on workflows registered by the camel-aws / 
aws-swf component


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/79c5ed6a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/79c5ed6a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/79c5ed6a

Branch: refs/heads/camel-2.15.x
Commit: 79c5ed6a759f82dcd49f40b9dbface59d977810f
Parents: dd08327
Author: Andrea Cosentino <anco...@gmail.com>
Authored: Tue Aug 4 17:25:49 2015 +0200
Committer: Andrea Cosentino <anco...@gmail.com>
Committed: Tue Aug 4 17:30:14 2015 +0200

----------------------------------------------------------------------
 .../aws/swf/CamelSWFWorkflowClient.java         |  6 +++++
 .../component/aws/swf/SWFConfiguration.java     | 26 ++++++++++++++++++++
 2 files changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/79c5ed6a/components/camel-aws/src/main/java/org/apache/camel/component/aws/swf/CamelSWFWorkflowClient.java
----------------------------------------------------------------------
diff --git 
a/components/camel-aws/src/main/java/org/apache/camel/component/aws/swf/CamelSWFWorkflowClient.java
 
b/components/camel-aws/src/main/java/org/apache/camel/component/aws/swf/CamelSWFWorkflowClient.java
index 23d3d6b..b59f05c 100644
--- 
a/components/camel-aws/src/main/java/org/apache/camel/component/aws/swf/CamelSWFWorkflowClient.java
+++ 
b/components/camel-aws/src/main/java/org/apache/camel/component/aws/swf/CamelSWFWorkflowClient.java
@@ -22,6 +22,8 @@ import java.util.Map;
 
 import 
com.amazonaws.services.simpleworkflow.flow.DynamicWorkflowClientExternal;
 import 
com.amazonaws.services.simpleworkflow.flow.DynamicWorkflowClientExternalImpl;
+import com.amazonaws.services.simpleworkflow.flow.StartWorkflowOptions;
+import com.amazonaws.services.simpleworkflow.flow.common.FlowHelpers;
 import 
com.amazonaws.services.simpleworkflow.flow.common.WorkflowExecutionUtils;
 import 
com.amazonaws.services.simpleworkflow.flow.worker.GenericWorkflowClientExternalImpl;
 import com.amazonaws.services.simpleworkflow.model.ChildPolicy;
@@ -70,6 +72,10 @@ public class CamelSWFWorkflowClient {
         workflowType.setVersion(version);
         dynamicWorkflowClientExternal.setWorkflowType(workflowType);
         
dynamicWorkflowClientExternal.startWorkflowExecution(toArray(arguments));
+        StartWorkflowOptions startWorkflowOptions = new StartWorkflowOptions();
+        
startWorkflowOptions.setTaskStartToCloseTimeoutSeconds(FlowHelpers.durationToSeconds(configuration.getTaskStartToCloseTimeout()));
+        
startWorkflowOptions.setExecutionStartToCloseTimeoutSeconds(FlowHelpers.durationToSeconds(configuration.getExecutionStartToCloseTimeout()));
+        
dynamicWorkflowClientExternal.setSchedulingOptions(startWorkflowOptions);
 
         String newWorkflowId = 
dynamicWorkflowClientExternal.getWorkflowExecution().getWorkflowId();
         String newRunId = 
dynamicWorkflowClientExternal.getWorkflowExecution().getRunId();

http://git-wip-us.apache.org/repos/asf/camel/blob/79c5ed6a/components/camel-aws/src/main/java/org/apache/camel/component/aws/swf/SWFConfiguration.java
----------------------------------------------------------------------
diff --git 
a/components/camel-aws/src/main/java/org/apache/camel/component/aws/swf/SWFConfiguration.java
 
b/components/camel-aws/src/main/java/org/apache/camel/component/aws/swf/SWFConfiguration.java
index 151dc13..0556d88 100644
--- 
a/components/camel-aws/src/main/java/org/apache/camel/component/aws/swf/SWFConfiguration.java
+++ 
b/components/camel-aws/src/main/java/org/apache/camel/component/aws/swf/SWFConfiguration.java
@@ -66,6 +66,10 @@ public class SWFConfiguration {
     private String stateResultType;
     @UriParam
     private String terminationDetails;
+    @UriParam(label = "producer,workflow", defaultValue = "300")
+    private String executionStartToCloseTimeout = "300";
+    @UriParam(label = "producer,workflow", defaultValue = "300")
+    private String taskStartToCloseTimeout = "300";
     @UriParam
     private DataConverter dataConverter;
     @UriParam
@@ -268,4 +272,26 @@ public class SWFConfiguration {
     public void setActivityThreadPoolSize(int activityThreadPoolSize) {
         this.activityThreadPoolSize = activityThreadPoolSize;
     }
+
+    /**
+     * Set the execution start to close timeout.
+     */
+    public String getExecutionStartToCloseTimeout() {
+        return executionStartToCloseTimeout;
+    }
+
+    public void setExecutionStartToCloseTimeout(String 
executionStartToCloseTimeout) {
+        this.executionStartToCloseTimeout = executionStartToCloseTimeout;
+    }
+
+    /**
+     * Set the task start to close timeout.
+     */
+    public String getTaskStartToCloseTimeout() {
+        return taskStartToCloseTimeout;
+    }
+
+    public void setTaskStartToCloseTimeout(String taskStartToCloseTimeout) {
+        this.taskStartToCloseTimeout = taskStartToCloseTimeout;
+    }
 }

Reply via email to