Class: AWS::Flow::DecisionHelper Private
- Inherits:
-
Object
- Object
- AWS::Flow::DecisionHelper
- Defined in:
- lib/aws/decider/async_decider.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A decision helper for a workflow.
Class Attribute Summary collapse
- .completion_events ⇒ Object readonly private
- .force_immediate_decision_timer ⇒ Object readonly private
- .maximum_decisions_per_completion ⇒ Object readonly private
Instance Attribute Summary collapse
- #activity_options ⇒ Object private
- #activity_scheduling_event_id_to_activity_id ⇒ Object private
- #child_initiated_event_id_to_workflow_id ⇒ Object private
- #decision_map ⇒ Object private
- #scheduled_activities ⇒ Object private
- #scheduled_external_workflows ⇒ Object private
- #scheduled_signals ⇒ Object private
- #scheduled_timers ⇒ Object private
- #signal_initiated_event_to_signal_id ⇒ Object private
- #workflow_context_data ⇒ Object private
Instance Method Summary collapse
-
#get_activity_id(scheduled_id) ⇒ Object
private
Returns the activity ID for a scheduled activity.
- #get_next_id(decision_target) ⇒ Object private
- #get_next_state_machine_which_will_schedule(list) ⇒ Object private
- #handle_decision_task_started_event ⇒ Object private
-
#initialize ⇒ DecisionHelper
constructor
private
Creates a new, empty DecisionHelper instance.
- #is_completion_event(decision) ⇒ Object private
- #method_missing(method_name, *args) ⇒ Object private
Constructor Details
#initialize ⇒ DecisionHelper
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Creates a new, empty AWS::Flow::DecisionHelper instance.
113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/aws/decider/async_decider.rb', line 113 def initialize @decision_map = {} @id = Hash.new {|hash, key| hash[key] = 0 } @scheduled_signals = {} @activity_scheduling_event_id_to_activity_id = {} @scheduled_activities = {} @scheduled_external_workflows = {} @scheduled_timers = {} @activity_options = {} @signal_initiated_event_to_signal_id = {} @child_initiated_event_id_to_workflow_id = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
170 171 172 173 174 |
# File 'lib/aws/decider/async_decider.rb', line 170 def method_missing(method_name, *args) if [:[]=, :[]].include? method_name @decision_map.send(method_name, *args) end end |
Class Attribute Details
.completion_events ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
106 107 108 |
# File 'lib/aws/decider/async_decider.rb', line 106 def completion_events @completion_events end |
.force_immediate_decision_timer ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
106 107 108 |
# File 'lib/aws/decider/async_decider.rb', line 106 def force_immediate_decision_timer @force_immediate_decision_timer end |
.maximum_decisions_per_completion ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
106 107 108 |
# File 'lib/aws/decider/async_decider.rb', line 106 def maximum_decisions_per_completion @maximum_decisions_per_completion end |
Instance Attribute Details
#activity_options ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
104 105 106 |
# File 'lib/aws/decider/async_decider.rb', line 104 def @activity_options end |
#activity_scheduling_event_id_to_activity_id ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
104 105 106 |
# File 'lib/aws/decider/async_decider.rb', line 104 def activity_scheduling_event_id_to_activity_id @activity_scheduling_event_id_to_activity_id end |
#child_initiated_event_id_to_workflow_id ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
104 105 106 |
# File 'lib/aws/decider/async_decider.rb', line 104 def child_initiated_event_id_to_workflow_id @child_initiated_event_id_to_workflow_id end |
#decision_map ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
104 105 106 |
# File 'lib/aws/decider/async_decider.rb', line 104 def decision_map @decision_map end |
#scheduled_activities ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
104 105 106 |
# File 'lib/aws/decider/async_decider.rb', line 104 def scheduled_activities @scheduled_activities end |
#scheduled_external_workflows ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
104 105 106 |
# File 'lib/aws/decider/async_decider.rb', line 104 def scheduled_external_workflows @scheduled_external_workflows end |
#scheduled_signals ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
104 105 106 |
# File 'lib/aws/decider/async_decider.rb', line 104 def scheduled_signals @scheduled_signals end |
#scheduled_timers ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
104 105 106 |
# File 'lib/aws/decider/async_decider.rb', line 104 def scheduled_timers @scheduled_timers end |
#signal_initiated_event_to_signal_id ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
104 105 106 |
# File 'lib/aws/decider/async_decider.rb', line 104 def signal_initiated_event_to_signal_id @signal_initiated_event_to_signal_id end |
#workflow_context_data ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
104 105 106 |
# File 'lib/aws/decider/async_decider.rb', line 104 def workflow_context_data @workflow_context_data end |
Instance Method Details
#get_activity_id(scheduled_id) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the activity ID for a scheduled activity.
182 183 184 |
# File 'lib/aws/decider/async_decider.rb', line 182 def get_activity_id(scheduled_id) activity_scheduling_event_id_to_activity_id[scheduled_id] end |
#get_next_id(decision_target) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
127 128 129 130 |
# File 'lib/aws/decider/async_decider.rb', line 127 def get_next_id(decision_target) id = (@id[decision_target] += 1) "#{decision_target}#{id}" end |
#get_next_state_machine_which_will_schedule(list) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
133 134 135 136 137 138 |
# File 'lib/aws/decider/async_decider.rb', line 133 def get_next_state_machine_which_will_schedule(list) return if list.empty? ele = list.shift ele = list.shift until (list.empty? || ele.get_decision != nil) ele end |
#handle_decision_task_started_event ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/aws/decider/async_decider.rb', line 145 def handle_decision_task_started_event # In order to ensure that the events we have already scheduled do not # make a decision, we will process only maximum_decisions_per_completion # here. count = 0 decision_list = @decision_map.values decision_state_machine = get_next_state_machine_which_will_schedule(decision_list) until decision_state_machine.nil? next_decision_state_machine = get_next_state_machine_which_will_schedule(decision_list) count += 1 if (count == DecisionHelper.maximum_decisions_per_completion && next_decision_state_machine != nil && ! is_completion_event(next_decision_state_machine)) break end decision_state_machine.consume(:handle_decision_task_started_event) decision_state_machine = next_decision_state_machine end if (next_decision_state_machine != nil && count < DecisionHelper.maximum_decisions_per_completion) next_decision_state_machine.consume(:handle_decision_task_started_event) end end |
#is_completion_event(decision) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
140 141 142 |
# File 'lib/aws/decider/async_decider.rb', line 140 def is_completion_event(decision) DecisionHelper.completion_events.include? decision.get_decision[:decision_type].to_sym end |