module AWS::Flow::Activities
Methods and constants related to activities.
@!attribute activity_client
Gets the {ActivityClient} contained by the class.
@!attribute activities
Gets the list of {ActivityType} objects that were created by the {#activity} method.
Attributes
activities[RW]
activity_client[RW]
Public Class Methods
extended(base)
click to toggle source
# File lib/aws/decider/activity.rb, line 364 def self.extended(base) base.send :include, InstanceMethods end
Public Instance Methods
_options()
click to toggle source
@api private
# File lib/aws/decider/activity.rb, line 404 def _options; @activities; end
activity(*activity_names, &block)
click to toggle source
Defines one or more activities with {ActivityRegistrationOptions} provided in the supplied block.
@param [Array] activity_names
The names of the activities to define. These names will be used to create {ActivityType} objects, one per name. Each activity type is named as *prefix.activity_name*, where the *prefix* is specified in the options block, and each *activity_name* comes from the list passed to this parameter.
@param [Hash] block
{ActivityRegistrationOptions} to use on the defined activities. The following options are *required* when registering an activity: * `version` - The version of the activity type. * `task_list` - The task list used to poll for activity tasks.
@example Defining an activity
new_activity_class = Class.new(MyActivity) do extend Activities activity :activity1 do { :default_task_heartbeat_timeout => "3600", :default_task_list => task_list, :default_task_schedule_to_close_timeout => "20", :default_task_schedule_to_start_timeout => "20", :default_task_start_to_close_timeout => "20", :default_task_priority => "0", :version => "1", :prefix_name => "ExampleActivity" } end def activity1 puts "Hello!" end end
# File lib/aws/decider/activity.rb, line 446 def activity(*activity_names, &block) options = Utilities::interpret_block_for_options(ActivityRegistrationOptions, block) activity_names.each do |activity_name| prefix_name = options.prefix_name || self.to_s activity_type = ActivityType.new(prefix_name + "." + activity_name.to_s, options.version, options) @activities ||= [] @activities << activity_type end end
look_upwards(variable)
click to toggle source
@api private
# File lib/aws/decider/activity.rb, line 396 def look_upwards(variable) precursors = self.ancestors.dup precursors.delete(self) results = precursors.map { |x| x.send(variable) if x.methods.map(&:to_sym).include? variable }.compact.flatten.uniq end