class SWF::DecisionTaskHandler
subclass must call .register(name, version), and define handle(runner, task)
Attributes
decision_task[R]
runner[R]
Public Class Methods
configuration_help_message()
click to toggle source
# File lib/swf/decision_task_handler.rb, line 27 def self.configuration_help_message "Each decision task handler running on this task list in this domain must know how to handle this workflow_type's name and version.\n" + "I only know: #{@@handler_classes_by_name_version.inspect}" end
fail!(task, args={})
click to toggle source
# File lib/swf/decision_task_handler.rb, line 18 def self.fail!(task, args={}) task.fail_workflow_execution(args) end
find_handler_class(task)
click to toggle source
# File lib/swf/decision_task_handler.rb, line 22 def self.find_handler_class(task) type = task.workflow_type @@handler_classes_by_name_version[ [type.name, type.version] ] end
new(runner, decision_task)
click to toggle source
# File lib/swf/decision_task_handler.rb, line 34 def initialize(runner, decision_task) @runner = runner @decision_task = decision_task end
register(name, version)
click to toggle source
Register statically self (subclass) to handle workflow_type with given name and version
# File lib/swf/decision_task_handler.rb, line 14 def self.register(name, version) @@handler_classes_by_name_version [ [name.to_s, version.to_s] ] = self end
Public Instance Methods
_new_events() { |e| ... }
click to toggle source
# File lib/swf/decision_task_handler.rb, line 53 def _new_events(&block) events.each {|e| yield(e) if e.new? } end
call_handle()
click to toggle source
# File lib/swf/decision_task_handler.rb, line 39 def call_handle handle end
event_input(event)
click to toggle source
# File lib/swf/decision_task_handler.rb, line 99 def event_input(event) JSON.parse(event.attributes.input) end
events()
click to toggle source
# File lib/swf/decision_task_handler.rb, line 43 def events # make events into an array to avoid token timeout issues # see https://forums.aws.amazon.com/thread.jspa?threadID=98925 @events ||= decision_task.events.to_a end
new_events()
click to toggle source
# File lib/swf/decision_task_handler.rb, line 49 def new_events enum_for(:_new_events) end
slot_time()
click to toggle source
slot time of 51.2 microseconds is way too little even 1 second still results in collision growing but it doesn’t seem to get to 10 so we’ll leave it at that for now
# File lib/swf/decision_task_handler.rb, line 63 def slot_time #5.12e-5 # you wish 1 end
workflow_input()
click to toggle source
# File lib/swf/decision_task_handler.rb, line 95 def workflow_input @workflow_input ||= JSON.parse(workflow_started_event.attributes.input) end
workflow_started_event()
click to toggle source
# File lib/swf/decision_task_handler.rb, line 85 def workflow_started_event @workflow_started_event ||= begin events.find {|e| e.event_type == 'WorkflowExecutionStarted' } or raise MissingWorkflowStartedEvent, "Missing WorkflowExecutionStarted event in #{runner}" end end
workflow_task_list()
click to toggle source
# File lib/swf/decision_task_handler.rb, line 91 def workflow_task_list @workflow_task_list ||= workflow_started_event.attributes.task_list end