class AWS::Flow::Replayer::ServiceDecisionTaskProvider

Loads a decision task directly from the AWS Simple Workflow Service.

Attributes

domain[R]
execution[R]
swf[R]

Public Class Methods

new(options = {}) click to toggle source

Initialize a new ServiceDecisionTaskProvider.

@param options a hash of options to provide. Entries for ‘:domain` and

`:execution` must be present in the hash.

@raise |ArgumentError| if either ‘:domain` or `:execution` is missing

from the *options* parameter.
# File lib/aws/replayer.rb, line 129
def initialize(options = {})
  raise ArgumentError.new("options hash must contain :domain") if options[:domain].nil?
  raise ArgumentError.new("options hash must contain :execution") if options[:execution].nil?
  @execution = options[:execution]
  @domain = options[:domain]
  @swf = AWS::SimpleWorkflow.new.client
end

Public Instance Methods

get_execution_info() click to toggle source

Call AWS Simple Workflow Service to get workflow execution information.

@return the execution information based on the ‘:execution` and

`:domain` provided as input to the class constructor.
# 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() click to toggle source

Get the complete workflow history.

# 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) click to toggle source

Fetches a page of workflow history.

@param page_token Optional. A page token used to retrieve a

particular page of results.
# 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