Module: Ntswf::ActivityWorker
- Includes:
- Worker
- Defined in:
- lib/ntswf/activity_worker.rb
Overview
Interface for a worker executing tasks
Constant Summary
Constants included from Worker
Instance Method Summary collapse
-
#process_activities ⇒ Object
Start the worker loop for activity tasks.
- #process_activity_task ⇒ Object
Methods included from Worker
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
#process_activities ⇒ Object
Start the worker loop for activity tasks.
9 10 11 |
# File 'lib/ntswf/activity_worker.rb', line 9 def process_activities loop { in_subprocess :process_activity_task } end |
#process_activity_task ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ntswf/activity_worker.rb', line 13 def process_activity_task announce("polling for activity task #{activity_task_list}") domain.activity_tasks.poll_for_single_task(activity_task_list) do |task| announce("got activity task #{task.activity_type.inspect} #{task.input}") begin yield task rescue => e notify(e, activity_type: task.activity_type.inspect, input: task.input) details = { error: e.[0, 1000], exception: e.class.to_s[0, 1000], } task.fail!(details: details.to_json, reason: 'Exception') end end end |