Module: SWF::Workflows

Extended by:
Workflows
Included in:
Workflows
Defined in:
lib/swf/workflows.rb

Instance Method Summary collapse

Instance Method Details

#effect_workflow_type(name, version, options = {}) ⇒ Object



7
8
9
10
11
# File 'lib/swf/workflows.rb', line 7

def effect_workflow_type(name, version, options={})
  @workflow_types ||= {}
  @workflow_types[[name, version]] ||= SWF.domain.workflow_types.find {|t| [t.name, t.version] == [name, version] }
  @workflow_types[[name, version]] ||= SWF.domain.workflow_types.create(name, version, options)
end

#start(options, execution_options) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/swf/workflows.rb', line 13

def start(options, execution_options)
  execution_options[:task_list] ||= SWF.task_list
  execution_options.merge!({
    input: options.to_json
  })
  workflow_type.start_execution(execution_options)
end

#wait_for_workflow_execution_complete(workflow_execution) ⇒ Object



21
22
23
24
# File 'lib/swf/workflows.rb', line 21

def wait_for_workflow_execution_complete(workflow_execution)
  sleep 1 while :open == (status = workflow_execution.status)
  raise "workflow_execution #{workflow_execution} did not succeed: #{workflow_execution.status}" unless status == :completed
end