Method: AWS::Flow::Workflows::InstanceMethods#continue_as_new

Defined in:
lib/aws/decider/decider.rb

#continue_as_new(*args, &block) ⇒ Object

Restarts the workflow as a new workflow execution.

Parameters:



497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
# File 'lib/aws/decider/decider.rb', line 497

def continue_as_new(*args, &block)
  continue_as_new_options = Utilities::interpret_block_for_options(ContinueAsNewOptions, block)
  @data_converter ||= YAMLDataConverter.new
  if ! args.empty?
    input = @data_converter.dump args
    continue_as_new_options.input = input
  end
  known_workflows = self.class.workflows
  # If there is only one workflow, we can unambiguously say that we should use that one.

  if known_workflows.length == 1
    continue_as_new_options.precursors << known_workflows.first.options
  end
  # If we can find a name that matches, use that one.
  if continue_as_new_options.execution_method
    matching_option = self.class.workflows.map(&:options).find {|x| x.execution_method == continue_as_new_options.execution_method }
    continue_as_new_options.precursors << matching_option unless matching_option.nil?
  end
  self.decision_context.workflow_context.continue_as_new_options = continue_as_new_options
end