Module: SWF::TaskHandler
- Included in:
- ActivityTaskHandler, DecisionTaskHandler
- Defined in:
- lib/swf/task_handler.rb
Overview
use extend, not include
Instance Method Summary collapse
Instance Method Details
#handle(runner, task) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/swf/task_handler.rb', line 8 def handle(runner, task) handler_class = nil handler = nil begin handler_class = get_handler_class_or_fail task return unless handler_class handler = handler_class.new(runner, task) handler.call_handle rescue => e puts "HANDLER #{self} ERROR:" begin details_json = JSON.pretty_unparse({ handler_class: handler_class && handler_class.name, handler: handler.to_s, error: e.inspect, backtrace: e.backtrace, }) puts details_json fail!(task, reason: "handler raised error", details: details_json[0...32768]) rescue msg = "FAIL to handle fail!!" puts msg # failing again will cause #<RuntimeError: already responded> #fail!(task, reason: msg) raise end end end |