class SWF::ActivityTaskHandler
subclass must call .register(), and define handle(runner, task)
Attributes
activity_task[R]
runner[R]
Public Class Methods
configuration_help_message()
click to toggle source
# File lib/swf/activity_task_handler.rb, line 40 def self.configuration_help_message "Each activity task handler running on this task list in this domain must provide a handler class with a handle_* function for this activity_type's name.\n" + "I only have these classes: #{@@handler_classes.inspect}" end
fail!(task, args={})
click to toggle source
# File lib/swf/activity_task_handler.rb, line 31 def self.fail!(task, args={}) task.fail!(args) end
find_handler_class(task)
click to toggle source
# File lib/swf/activity_task_handler.rb, line 35 def self.find_handler_class(task) @@handler_classes.find {|x| x.instance_methods.include? handler_method_name task } # TODO: detect when two classes define the same named handle_* method ?!?! end
handler_method_name(task)
click to toggle source
# File lib/swf/activity_task_handler.rb, line 45 def self.handler_method_name(task) "handle_#{task.activity_type.name}".to_sym end
new(runner, task)
click to toggle source
# File lib/swf/activity_task_handler.rb, line 13 def initialize(runner, task) @runner = runner @activity_task = task end
register()
click to toggle source
Register statically self (subclass) to handle activities
# File lib/swf/activity_task_handler.rb, line 27 def self.register @@handler_classes << self end
Public Instance Methods
activity_task_input()
click to toggle source
# File lib/swf/activity_task_handler.rb, line 22 def activity_task_input JSON.parse(activity_task.input) end
call_handle()
click to toggle source
# File lib/swf/activity_task_handler.rb, line 18 def call_handle send self.class.handler_method_name(activity_task) end