Class: AWS::Flow::Replayer::ServiceDecisionTaskProvider
- Inherits:
-
DecisionTaskProvider
- Object
- DecisionTaskProvider
- AWS::Flow::Replayer::ServiceDecisionTaskProvider
- Defined in:
- lib/aws/replayer.rb
Overview
Loads a decision task directly from the AWS Simple Workflow Service.
Instance Attribute Summary collapse
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#execution ⇒ Object
readonly
Returns the value of attribute execution.
-
#swf ⇒ Object
readonly
Returns the value of attribute swf.
Instance Method Summary collapse
-
#get_execution_info ⇒ Object
Call AWS Simple Workflow Service to get workflow execution information.
-
#get_history ⇒ Object
Get the complete workflow history.
-
#get_history_page(page_token = nil) ⇒ Object
Fetches a page of workflow history.
-
#initialize(options = {}) ⇒ ServiceDecisionTaskProvider
constructor
Initialize a new ServiceDecisionTaskProvider.
Methods inherited from DecisionTaskProvider
#get_decision_task, #truncate_history
Constructor Details
#initialize(options = {}) ⇒ ServiceDecisionTaskProvider
Initialize a new ServiceDecisionTaskProvider.
129 130 131 132 133 134 135 |
# File 'lib/aws/replayer.rb', line 129 def initialize( = {}) raise ArgumentError.new("options hash must contain :domain") if [:domain].nil? raise ArgumentError.new("options hash must contain :execution") if [:execution].nil? @execution = [:execution] @domain = [:domain] @swf = AWS::SimpleWorkflow.new.client end |
Instance Attribute Details
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
119 120 121 |
# File 'lib/aws/replayer.rb', line 119 def domain @domain end |
#execution ⇒ Object (readonly)
Returns the value of attribute execution.
119 120 121 |
# File 'lib/aws/replayer.rb', line 119 def execution @execution end |
#swf ⇒ Object (readonly)
Returns the value of attribute swf.
119 120 121 |
# File 'lib/aws/replayer.rb', line 119 def swf @swf end |
Instance Method Details
#get_execution_info ⇒ Object
Call AWS Simple Workflow Service to get workflow execution information.
172 173 174 175 176 177 178 |
# File 'lib/aws/replayer.rb', line 172 def get_execution_info execution = @swf.describe_workflow_execution( domain: @domain, execution: @execution ) execution["executionInfo"] end |
#get_history ⇒ Object
Get the complete workflow history.
138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/aws/replayer.rb', line 138 def get_history events = [] # Get the first page of the workflow history page = get_history_page page["events"].each { |x| events << x } # Get the remaining pages of the workflow history until page["nextPageToken"].nil? page = get_history_page(page["nextPageToken"]) page["events"].each { |x| events << x } end events end |
#get_history_page(page_token = nil) ⇒ Object
Fetches a page of workflow history.
156 157 158 159 160 161 162 163 164 165 |
# File 'lib/aws/replayer.rb', line 156 def get_history_page(page_token = nil) # Generate the request options for the service call. Optionally merge # next_page_token to the hash if the page_token value is not nil. request_opts = { domain: @domain, execution: @execution, }.merge(page_token ? { next_page_token: page_token } : {}) @swf.get_workflow_execution_history(request_opts) end |