class AWS::Flow::WorkflowDefinitionFactory

Attributes

converter[R]

Public Class Methods

generate_definition_map(workflow_class) click to toggle source

Method to create a workflow definition map from a workflow class

# File lib/aws/decider/workflow_definition_factory.rb, line 23
def generate_definition_map(workflow_class)

  unless workflow_class.respond_to?(:workflows)
    raise ArgumentError.new("workflow_class must extend module AWS::Flow::Workflows")
  end

  workflow_definition_map = {}

  workflow_class.workflows.each do |workflow_type|
    options = workflow_type.options
    execution_method = options.execution_method
    registration_options = options.get_registration_options
    get_state_method = workflow_class.get_state_method
    signals = workflow_class.signals

    workflow_definition_map[workflow_type] = self.new(
      workflow_class,
      workflow_type,
      registration_options,
      options,
      execution_method,
      signals,
      get_state_method
    )
  end
  workflow_definition_map
end
new(klass, workflow_type, registration_options, implementation_options, workflow_method, signals, get_state_method) click to toggle source
# File lib/aws/decider/workflow_definition_factory.rb, line 53
def initialize(klass, workflow_type, registration_options, implementation_options, workflow_method, signals, get_state_method)
  @klass = klass
  @workflow_type = workflow_type
  @registration_options = registration_options
  @implementation_options = implementation_options
  @workflow_method = workflow_method
  @signals = signals
  @get_state_method = get_state_method
  if ! implementation_options.nil?
    @converter = implementation_options.data_converter
  end
  @converter ||= FlowConstants.data_converter

end

Public Instance Methods

delete_workflow_definition(definition) click to toggle source
# File lib/aws/decider/workflow_definition_factory.rb, line 74
def delete_workflow_definition(definition)
  FlowFiber.unset(FlowFiber.current, :decision_context)
  # Indicates to GC that these values are no longer needed.
  FlowFiber.local_variables.each_pair do |key, value|
    value = nil
    FlowFiber.local_variables.delete(key)
  end
end
get_workflow_definition(decision_context) click to toggle source
# File lib/aws/decider/workflow_definition_factory.rb, line 68
def get_workflow_definition(decision_context)
  FlowFiber.current[:decision_context] = decision_context
  this_instance = @klass.new
  WorkflowDefinition.new(this_instance, @workflow_method, @signals, @get_state_method, @converter)
end