Class: AWS::Flow::Replayer::ServiceDecisionTaskProvider

Inherits:
DecisionTaskProvider show all
Defined in:
lib/aws/replayer.rb

Overview

This DecisionTaskProvider loads the decision task directly from the SimpleWorkflowService

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DecisionTaskProvider

#get_decision_task, #truncate_history

Constructor Details

#initialize(options = {}) ⇒ ServiceDecisionTaskProvider

Returns a new instance of ServiceDecisionTaskProvider.

Raises:

  • (ArgumentError)


70
71
72
73
74
75
76
# File 'lib/aws/replayer.rb', line 70

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

Instance Attribute Details

#domainObject (readonly)

Returns the value of attribute domain.



68
69
70
# File 'lib/aws/replayer.rb', line 68

def domain
  @domain
end

#executionObject (readonly)

Returns the value of attribute execution.



68
69
70
# File 'lib/aws/replayer.rb', line 68

def execution
  @execution
end

#swfObject (readonly)

Returns the value of attribute swf.



68
69
70
# File 'lib/aws/replayer.rb', line 68

def swf
  @swf
end

Instance Method Details

#get_execution_infoObject

This method calls the service to get the workflow execution information



106
107
108
109
110
111
112
# File 'lib/aws/replayer.rb', line 106

def get_execution_info
  execution = @swf.describe_workflow_execution(
    domain: @domain,
    execution: @execution
  )
  execution["executionInfo"]
end

#get_historyObject



78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/aws/replayer.rb', line 78

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

This method calls the service to fetch a page of workflow history



93
94
95
96
97
98
99
100
101
102
# File 'lib/aws/replayer.rb', line 93

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