Repository: camel
Updated Branches:
  refs/heads/master 1a73fa61a -> f50e38209


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/f50e3820
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f50e3820
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f50e3820

Branch: refs/heads/master
Commit: f50e38209b07e44e1f7c2bc7bd853a9b562becea
Parents: 1a73fa6
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:26:12 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/f50e3820/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/f50e3820/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 c54f985..d6a40fa 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(label = "producer,workflow")
     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(label = "producer,activity")
@@ -331,4 +335,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