Class: AWS::Flow::Replayer::WorkflowReplayer

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ WorkflowReplayer

Returns a new instance of WorkflowReplayer.

Raises:

  • (ArgumentError)


140
141
142
143
144
145
146
147
148
# File 'lib/aws/replayer.rb', line 140

def initialize(options)
  raise ArgumentError.new("You must pass in an options hash") if options.nil?
  raise ArgumentError.new("options hash must contain :workflow_class") if options[:workflow_class].nil?

  # Create the service decision task helper to fetch and truncate the
  # history
  @task_provider = ServiceDecisionTaskProvider.new(options)
  @task_handler = DecisionTaskHandler.from_workflow_class(options[:workflow_class])
end

Instance Attribute Details

#task_handlerObject (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_providerObject (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