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_name, #activity_task_lists, #activity_type, #configure, #decision_task_list, #default_unit, #domain, #execution_id_prefix, #execution_version, #notify, #on_notify, #parse_input, #separator, #swf, #workflow_name, #workflow_version

Instance Method Details

#find(ids) ⇒ Hash

Get status and details of a workflow execution.

Parameters:

  • ids (Hash)

    Identifies the queried execution

Options Hash (ids):

  • :workflow_id (String)

    Workflow ID

  • :run_id (String)

    Run ID

Returns:

  • (Hash)

    Execution properties.

    :exception

    Exception message for an unexpectedly failed execution

    :error

    Error message returned from an execution

    :outcome

    Result of a completed execution

    :params

    Custom params from JSON

    :run_id

    The workflow execution’s run ID

    :status

    Calculated workflow execution status (:completed, :open, others indicating failure)

    :name

    Given task kind

    :workflow_id

    The workflow execution’s workflow ID

Raises:



52
53
54
55
# File 'lib/ntswf/client.rb', line 52

def find(ids)
  workflow_execution = domain.workflow_executions.at(ids[:workflow_id], ids[:run_id])
  history_details(workflow_execution)
end

#start_execution(options) ⇒ Hash

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

  • :tag_list (Array<String>)

    Additional strings that will be added to to the tag list of the workflow execution.

  • :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:

  • (Hash)

    Execution properties.

    :exception

    Exception message for an unexpectedly failed execution

    :error

    Error message returned from an execution

    :outcome

    Result of a completed execution

    :params

    Custom params from JSON

    :run_id

    The workflow execution’s run ID

    :status

    Calculated workflow execution status (:completed, :open, others indicating failure)

    :name

    Given task kind

    :workflow_id

    The workflow execution’s workflow ID

Raises:



29
30
31
32
33
34
35
# File 'lib/ntswf/client.rb', line 29

def start_execution(options)
  workflow_execution = start_swf_workflow_execution(options)
  execution_details(workflow_execution).merge!(
    name: options[:name].to_s,
    params: options[:params],
  )
end