You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Siddharth Sharma (JIRA)" <ji...@apache.org> on 2016/07/16 20:54:20 UTC

[jira] [Comment Edited] (CAMEL-8598) Set default timeouts on workflows registered by the camel-aws / aws-swf component

    [ https://issues.apache.org/jira/browse/CAMEL-8598?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15380938#comment-15380938 ] 

Siddharth Sharma edited comment on CAMEL-8598 at 7/16/16 8:53 PM:
------------------------------------------------------------------

[~davsclaus] I encountered the same issue while using camel-swf (latest 2.17) and even after the defaults by Camel client, it seems the scheduling options are not used by AWS client as the StartWorkflowOptions parameters are injected after a workflow is created

CamelSWFWorkflowClient#startWorkflowExecution
{code}
  public String[] startWorkflowExecution(String workflowId, String runId, String eventName, String version, Object arguments) {
        DynamicWorkflowClientExternalImpl dynamicWorkflowClientExternal = (DynamicWorkflowClientExternalImpl) getDynamicWorkflowClient(workflowId, runId);

        WorkflowType workflowType = new WorkflowType();
        workflowType.setName(eventName);
        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();

        return new String[] {newWorkflowId, newRunId};
    }
{code}

Seems, it should be

{code}
  public String[] startWorkflowExecution(String workflowId, String runId, String eventName, String version, Object arguments) {
        DynamicWorkflowClientExternalImpl dynamicWorkflowClientExternal = (DynamicWorkflowClientExternalImpl) getDynamicWorkflowClient(workflowId, runId);

        WorkflowType workflowType = new WorkflowType();
        workflowType.setName(eventName);
        workflowType.setVersion(version);
        dynamicWorkflowClientExternal.setWorkflowType(workflowType);
        StartWorkflowOptions startWorkflowOptions = new StartWorkflowOptions();
          startWorkflowOptions.setTaskStartToCloseTimeoutSeconds(FlowHelpers.durationToSeconds(configuration.getTaskStartToCloseTimeout()));
        startWorkflowOptions.setExecutionStartToCloseTimeoutSeconds(FlowHelpers.durationToSeconds(configuration.getExecutionStartToCloseTimeout()));
        dynamicWorkflowClientExternal.setSchedulingOptions(startWorkflowOptions);
        dynamicWorkflowClientExternal.startWorkflowExecution(toArray(arguments));
        
        String newWorkflowId = dynamicWorkflowClientExternal.getWorkflowExecution().getWorkflowId();
        String newRunId = dynamicWorkflowClientExternal.getWorkflowExecution().getRunId();

        return new String[] {newWorkflowId, newRunId};
    }
{code}


was (Author: sidshar):
[~davsclaus] I encountered the same issue while camel-swf and even after the defaults by Camel, it seems the scheduling options are not used by AWS client as the parameters are injected after a workflow is created

CamelSWFWorkflowClient#startWorkflowExecution
{code}
  public String[] startWorkflowExecution(String workflowId, String runId, String eventName, String version, Object arguments) {
        DynamicWorkflowClientExternalImpl dynamicWorkflowClientExternal = (DynamicWorkflowClientExternalImpl) getDynamicWorkflowClient(workflowId, runId);

        WorkflowType workflowType = new WorkflowType();
        workflowType.setName(eventName);
        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();

        return new String[] {newWorkflowId, newRunId};
    }
{code}

Seems, it should be

{code}
  public String[] startWorkflowExecution(String workflowId, String runId, String eventName, String version, Object arguments) {
        DynamicWorkflowClientExternalImpl dynamicWorkflowClientExternal = (DynamicWorkflowClientExternalImpl) getDynamicWorkflowClient(workflowId, runId);

        WorkflowType workflowType = new WorkflowType();
        workflowType.setName(eventName);
        workflowType.setVersion(version);
        dynamicWorkflowClientExternal.setWorkflowType(workflowType);
        StartWorkflowOptions startWorkflowOptions = new StartWorkflowOptions();
          startWorkflowOptions.setTaskStartToCloseTimeoutSeconds(FlowHelpers.durationToSeconds(configuration.getTaskStartToCloseTimeout()));
        startWorkflowOptions.setExecutionStartToCloseTimeoutSeconds(FlowHelpers.durationToSeconds(configuration.getExecutionStartToCloseTimeout()));
        dynamicWorkflowClientExternal.setSchedulingOptions(startWorkflowOptions);
        dynamicWorkflowClientExternal.startWorkflowExecution(toArray(arguments));
        
        String newWorkflowId = dynamicWorkflowClientExternal.getWorkflowExecution().getWorkflowId();
        String newRunId = dynamicWorkflowClientExternal.getWorkflowExecution().getRunId();

        return new String[] {newWorkflowId, newRunId};
    }
{code}

> Set default timeouts on workflows registered by the camel-aws / aws-swf component
> ---------------------------------------------------------------------------------
>
>                 Key: CAMEL-8598
>                 URL: https://issues.apache.org/jira/browse/CAMEL-8598
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-aws
>    Affects Versions: 2.14.2
>            Reporter: Derek Abdine
>            Assignee: Andrea Cosentino
>            Priority: Minor
>             Fix For: 2.15.3, 2.16.0
>
>
> The aws-swf component does not set a default "Execution Start To Close Timeout" or "Task Start To Close Timeout" when workflows are newly registered. 
> This has the effect of scheduled workflows immediately moving to the TIMEOUT state (and being tracked as timed out in the AWS SWF UI).
> *workarounds*
> For newcomers to the aws-swf component this is particularly confusing. My work-around was to explicitly create the workflow type in the AWS SWF UI before camel had a chance to register it with proper timeouts (the UI requires you to set a timeout, which may mean there's also a bug in the AWS API). Another approach looks to be related to the workflowTypeRegistrationOptions uri option on the aws-swf endpoint, though I haven't validated that approach as a work-around for this issue, so explore at your own risk.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)