Class: DurableFlow::StepProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/durable_flow/step_proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(workflow) ⇒ StepProxy

Returns a new instance of StepProxy.



5
6
7
# File 'lib/durable_flow/step_proxy.rb', line 5

def initialize(workflow)
  @workflow = workflow
end

Instance Method Details

#sleep(name, duration = nil, **options) ⇒ Object



9
10
11
# File 'lib/durable_flow/step_proxy.rb', line 9

def sleep(name, duration = nil, **options)
  @workflow.sleep_step(name, duration, until_time: options[:until] || options[:until_time])
end

#wait_for_event(name, event: nil, timeout: nil, match: {}) ⇒ Object



13
14
15
# File 'lib/durable_flow/step_proxy.rb', line 13

def wait_for_event(name, event: nil, timeout: nil, match: {})
  @workflow.wait_for_event_step(name, event_name: event || name, timeout: timeout, match: match)
end

#wait_for_workflow(name, workflow_or_run_id, timeout: nil) ⇒ Object



17
18
19
20
# File 'lib/durable_flow/step_proxy.rb', line 17

def wait_for_workflow(name, workflow_or_run_id, timeout: nil)
  run_id = workflow_or_run_id.respond_to?(:job_id) ? workflow_or_run_id.job_id : workflow_or_run_id.to_s
  wait_for_event(name, event: DurableFlow::WORKFLOW_COMPLETED_EVENT, timeout: timeout, match: { run_id: run_id })
end