def schedule_activity_task activity_type, options = {}
options[:activity_id] ||= UUIDTools::UUID.random_create.to_s
options[:activity_type] = case activity_type
when Hash
unless
activity_type[:name].is_a?(String) and
activity_type[:version].is_a?(String) and
activity_type.keys.length == 2
then
msg = 'activity_type hash must have :name and :version strings'
raise ArgumentError, msg
end
activity_type
when ActivityType
{ :name => activity_type.name, :version => activity_type.version }
else
msg = 'expected activity_type to be an ActivityType object or a hash'
raise ArgumentError, msg
end
duration_opts(options,
:heartbeat_timeout,
:schedule_to_close_timeout,
:schedule_to_start_timeout,
:start_to_close_timeout)
if task_list = options[:task_list]
options[:task_list] = { :name => task_list }
end
add_decision :schedule_activity_task, options
end