Class: Temporalio::Client::WorkflowUpdateHandle

Inherits:
Object
  • Object
show all
Defined in:
lib/temporalio/client/workflow_update_handle.rb

Overview

Handle for a workflow update execution request. This is usually created via Temporalio::Client::WorkflowHandle#start_update or Temporalio::Client::WorkflowHandle#update_handle.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idString (readonly)



13
14
15
# File 'lib/temporalio/client/workflow_update_handle.rb', line 13

def id
  @id
end

#workflow_idString (readonly)



16
17
18
# File 'lib/temporalio/client/workflow_update_handle.rb', line 16

def workflow_id
  @workflow_id
end

#workflow_run_idString? (readonly)



19
20
21
# File 'lib/temporalio/client/workflow_update_handle.rb', line 19

def workflow_run_id
  @workflow_run_id
end

Instance Method Details

#result(rpc_options: nil) ⇒ Object?

Wait for and return the result of the update. The result may already be known in which case no network call is made. Otherwise the result will be polled for until it is returned.

Raises:



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/temporalio/client/workflow_update_handle.rb', line 47

def result(rpc_options: nil)
  @known_outcome ||= @client._impl.poll_workflow_update(Interceptor::PollWorkflowUpdateInput.new(
                                                          workflow_id:,
                                                          run_id: workflow_run_id,
                                                          update_id: id,
                                                          rpc_options:
                                                        ))

  if @known_outcome.failure
    raise Error::WorkflowUpdateFailedError.new, cause: @client.data_converter.from_failure(@known_outcome.failure)
  end

  results = @client.data_converter.from_payloads(@known_outcome.success)
  warn("Expected 0 or 1 update result, got #{results.size}") if results.size > 1
  results.first
end

#result_obtained?Boolean



32
33
34
# File 'lib/temporalio/client/workflow_update_handle.rb', line 32

def result_obtained?
  !@known_outcome.nil?
end