Class: Temporalio::Client::WorkflowUpdateHandle
- Inherits:
-
Object
- Object
- Temporalio::Client::WorkflowUpdateHandle
- 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
-
#id ⇒ String
readonly
ID for the workflow update.
-
#workflow_id ⇒ String
readonly
ID for the workflow.
-
#workflow_run_id ⇒ String?
readonly
Run ID for the workflow.
Instance Method Summary collapse
-
#result(rpc_metadata: nil, rpc_timeout: nil) ⇒ Object?
Wait for and return the result of the update.
- #result_obtained? ⇒ Boolean
Instance Attribute Details
#id ⇒ String (readonly)
Returns ID for the workflow update.
13 14 15 |
# File 'lib/temporalio/client/workflow_update_handle.rb', line 13 def id @id end |
#workflow_id ⇒ String (readonly)
Returns ID for the workflow.
16 17 18 |
# File 'lib/temporalio/client/workflow_update_handle.rb', line 16 def workflow_id @workflow_id end |
#workflow_run_id ⇒ String? (readonly)
Returns Run ID for the workflow.
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_metadata: nil, rpc_timeout: 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.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/temporalio/client/workflow_update_handle.rb', line 48 def result(rpc_metadata: nil, rpc_timeout: nil) @known_outcome ||= @client._impl.poll_workflow_update(Interceptor::PollWorkflowUpdateInput.new( workflow_id:, run_id: workflow_run_id, update_id: id, rpc_metadata:, rpc_timeout: )) 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 |