Class: Temporalio::Internal::Worker::WorkflowInstance::ChildWorkflowHandle
- Inherits:
-
Workflow::ChildWorkflowHandle
- Object
- Workflow::ChildWorkflowHandle
- Temporalio::Internal::Worker::WorkflowInstance::ChildWorkflowHandle
- Defined in:
- lib/temporalio/internal/worker/workflow_instance/child_workflow_handle.rb
Overview
Implementation of the child workflow handle.
Instance Attribute Summary collapse
-
#first_execution_run_id ⇒ Object
readonly
Returns the value of attribute first_execution_run_id.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#result_hint ⇒ Object
readonly
Returns the value of attribute result_hint.
Instance Method Summary collapse
- #_resolve(resolution) ⇒ Object
-
#initialize(id:, first_execution_run_id:, instance:, cancellation:, cancel_callback_key:, result_hint:) ⇒ ChildWorkflowHandle
constructor
rubocop:disable Lint/MissingSuper.
- #result(result_hint: nil) ⇒ Object
- #signal(signal, *args, cancellation: Workflow.cancellation, arg_hints: nil) ⇒ Object
Constructor Details
#initialize(id:, first_execution_run_id:, instance:, cancellation:, cancel_callback_key:, result_hint:) ⇒ ChildWorkflowHandle
rubocop:disable Lint/MissingSuper
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/temporalio/internal/worker/workflow_instance/child_workflow_handle.rb', line 15 def initialize(id:, first_execution_run_id:, instance:, # rubocop:disable Lint/MissingSuper cancellation:, cancel_callback_key:, result_hint:) @id = id @first_execution_run_id = first_execution_run_id @instance = instance @cancellation = cancellation @cancel_callback_key = cancel_callback_key @result_hint = result_hint @resolution = nil end |
Instance Attribute Details
#first_execution_run_id ⇒ Object (readonly)
Returns the value of attribute first_execution_run_id.
13 14 15 |
# File 'lib/temporalio/internal/worker/workflow_instance/child_workflow_handle.rb', line 13 def first_execution_run_id @first_execution_run_id end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
13 14 15 |
# File 'lib/temporalio/internal/worker/workflow_instance/child_workflow_handle.rb', line 13 def id @id end |
#result_hint ⇒ Object (readonly)
Returns the value of attribute result_hint.
13 14 15 |
# File 'lib/temporalio/internal/worker/workflow_instance/child_workflow_handle.rb', line 13 def result_hint @result_hint end |
Instance Method Details
#_resolve(resolution) ⇒ Object
44 45 46 47 |
# File 'lib/temporalio/internal/worker/workflow_instance/child_workflow_handle.rb', line 44 def _resolve(resolution) @cancellation.remove_cancel_callback(@cancel_callback_key) @resolution = resolution end |
#result(result_hint: nil) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/temporalio/internal/worker/workflow_instance/child_workflow_handle.rb', line 26 def result(result_hint: nil) # Notice that we actually provide a detached cancellation here instead of defaulting to workflow # cancellation because we don't want workflow cancellation (or a user-provided cancellation to this result # call) to be able to interrupt waiting on a child that may be processing the cancellation. Workflow.wait_condition(cancellation: Cancellation.new) { @resolution } case @resolution.status when :completed @instance.payload_converter.from_payload(@resolution.completed.result, hint: result_hint || @result_hint) when :failed raise @instance.failure_converter.from_failure(@resolution.failed.failure, @instance.payload_converter) when :cancelled raise @instance.failure_converter.from_failure(@resolution.cancelled.failure, @instance.payload_converter) else raise "Unrecognized resolution status: #{@resolution.status}" end end |
#signal(signal, *args, cancellation: Workflow.cancellation, arg_hints: nil) ⇒ Object
49 50 51 |
# File 'lib/temporalio/internal/worker/workflow_instance/child_workflow_handle.rb', line 49 def signal(signal, *args, cancellation: Workflow.cancellation, arg_hints: nil) @instance.context._signal_child_workflow(id:, signal:, args:, cancellation:, arg_hints:) end |