Class: AWS::Flow::Replayer::WorkflowReplayer
- Inherits:
-
Object
- Object
- AWS::Flow::Replayer::WorkflowReplayer
- Defined in:
- lib/aws/replayer.rb
Overview
WorkflowReplayer is an AWS Flow Framework utility that is used to ‘replay’ a workflow history in the decider against the workflow implementation. It is a useful debugging tool.
Usage -
# Create an instance of the replayer with the required options -
replayer = AWS::Flow::Replayer::WorkflowReplayer.new(
domain: '<domain_name>',
execution: {
workflow_id: "<workflow_id",
run_id: "<run_id>"
},
workflow_class: WorkflowClass
)
# Call the replay method (optionally) with the replay_upto event_id number -
decision = replayer.replay(20)
Instance Attribute Summary collapse
-
#task_handler ⇒ Object
readonly
Returns the value of attribute task_handler.
-
#task_provider ⇒ Object
readonly
Returns the value of attribute task_provider.
Instance Method Summary collapse
-
#initialize(options) ⇒ WorkflowReplayer
constructor
A new instance of WorkflowReplayer.
-
#replay(replay_upto = nil) ⇒ Object
This method performs the actual replay.
Constructor Details
#initialize(options) ⇒ WorkflowReplayer
Returns a new instance of WorkflowReplayer.
140 141 142 143 144 145 146 147 148 |
# File 'lib/aws/replayer.rb', line 140 def initialize() raise ArgumentError.new("You must pass in an options hash") if .nil? raise ArgumentError.new("options hash must contain :workflow_class") if [:workflow_class].nil? # Create the service decision task helper to fetch and truncate the # history @task_provider = ServiceDecisionTaskProvider.new() @task_handler = DecisionTaskHandler.from_workflow_class([:workflow_class]) end |
Instance Attribute Details
#task_handler ⇒ Object (readonly)
Returns the value of attribute task_handler.
138 139 140 |
# File 'lib/aws/replayer.rb', line 138 def task_handler @task_handler end |
#task_provider ⇒ Object (readonly)
Returns the value of attribute task_provider.
138 139 140 |
# File 'lib/aws/replayer.rb', line 138 def task_provider @task_provider end |
Instance Method Details
#replay(replay_upto = nil) ⇒ Object
This method performs the actual replay.
151 152 153 154 |
# File 'lib/aws/replayer.rb', line 151 def replay(replay_upto = nil) task = @task_provider.get_decision_task(replay_upto) @task_handler.handle_decision_task(task) unless task.nil? end |