Module: Ntswf::Client

Includes:
Base
Defined in:
lib/ntswf/client.rb

Overview

Interface for an application that wishes to start a task

Instance Method Summary collapse

Methods included from Base

#activity_task_list, #activity_task_lists, #activity_type, #decision_task_list, #default_unit, #domain, #execution_version, #initialize, #notify, #parse_input, #separator, #swf, #workflow_name, #workflow_version

Instance Method Details

#start_execution(options) ⇒ AWS::SimpleWorkflow::WorkflowExecution

Enqueue a new SWF task.

The options configure the control flow of the task. Excluding :execution_id they will be stored in the input argument of the task as JSON.

Parameters:

  • options (Hash)

    The task’s options. Keys with special meaning:

Options Hash (options):

  • :execution_id (String)

    Mandatory workflow ID suffix, allowed IDs are documented at docs.amazonwebservices.com (WorkflowId Property)

  • :interval (Numeric)

    Optional, in seconds. Enforces periodic start of new executions, even in case of failure

  • :name (String)

    Identifies the kind of task for the executing unit

  • :params (Hash)

    Custom task parameters passed on to the executing unit

  • :unit (String)

    The executing unit’s key, a corresponding activity task list must be configured

  • :version (Numeric)

    Optional minimum version of the client. The task may be rescheduled by older clients.

Returns:

  • (AWS::SimpleWorkflow::WorkflowExecution)

Raises:

  • (AWS::SimpleWorkflow::Errors::WorkflowExecutionAlreadyStartedFault)


27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/ntswf/client.rb', line 27

def start_execution(options)
  execution_id = options.delete(:execution_id)
  workflow_type.start_execution(
    child_policy: :terminate,
    execution_start_to_close_timeout: 48 * 3600,
    input: options.to_json,
    tag_list: [options[:unit].to_s, options[:name].to_s],
    task_list: decision_task_list,
    task_start_to_close_timeout: 10 * 60,
    workflow_id: [activity_task_list, execution_id].join(separator),
  )
end