Module: Ntswf::DecisionWorker

Includes:
Worker
Defined in:
lib/ntswf/decision_worker.rb

Overview

Interface for a worker arbitrating tasks, optionally for multiple apps

Constant Summary

Constants included from Worker

Worker::RETRY

Instance Method Summary collapse

Methods included from Worker

#in_subprocess

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

#process_decision_taskObject

Process a decision task. The following task values are interpreted:

input

see Client#start_execution

reason

reschedule if Worker::RETRY

result

Interpreted as Hash, see below for keys

Result keys

:seconds_until_retry

See ActivityWorker#on_activity



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/ntswf/decision_worker.rb', line 20

def process_decision_task
  announce("polling for decision task #{decision_task_list}")
  domain.decision_tasks.poll_for_single_task(decision_task_list, poll_options) do |task|
    announce("got decision task #{task.workflow_execution.inspect}")
    begin
      task.new_events.each { |event| process_decision_event(task, event) }
    rescue => e
      notify(e, workflow_execution: task.workflow_execution.inspect)
      raise e
    end
  end
end

#process_decisionsObject

Start the worker loop for decision tasks.



9
10
11
# File 'lib/ntswf/decision_worker.rb', line 9

def process_decisions
  loop { in_subprocess :process_decision_task }
end