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.
-
#result_hint ⇒ Object?
readonly
Result hint if one set when the handle was created.
-
#workflow_id ⇒ String
readonly
ID for the workflow.
-
#workflow_run_id ⇒ String?
readonly
Run ID for the workflow.
Instance Method Summary collapse
-
#result(result_hint: nil, rpc_options: 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 |
#result_hint ⇒ Object? (readonly)
Returns Result hint if one set when the handle was created.
22 23 24 |
# File 'lib/temporalio/client/workflow_update_handle.rb', line 22 def result_hint @result_hint 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(result_hint: nil, 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.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/temporalio/client/workflow_update_handle.rb', line 52 def result(result_hint: nil, 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, hints: Array(result_hint || @result_hint)) warn("Expected 0 or 1 update result, got #{results.size}") if results.size > 1 results.first end |
#result_obtained? ⇒ Boolean
36 37 38 |
# File 'lib/temporalio/client/workflow_update_handle.rb', line 36 def result_obtained? !@known_outcome.nil? end |