Class: Temporalio::Client::Implementation Private

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

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(connection, namespace, converter, interceptors) ⇒ Implementation

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Implementation.



17
18
19
20
21
22
23
# File 'lib/temporalio/client/implementation.rb', line 17

def initialize(connection, namespace, converter, interceptors)
  @connection = connection
  @namespace = namespace
  @converter = converter
  @interceptor_chain = Interceptor::Chain.new(interceptors)
  @identity = "#{Process.pid}@#{Socket.gethostname} (Ruby SDK v#{VERSION})"
end

Instance Method Details

#await_workflow_result(id, run_id, follow_runs, rpc_metadata, rpc_timeout) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/temporalio/client/implementation.rb', line 61

def await_workflow_result(id, run_id, follow_runs, , rpc_timeout)
  rpc_params = { metadata: , timeout: rpc_timeout }
  request = Temporalio::Api::WorkflowService::V1::GetWorkflowExecutionHistoryRequest.new(
    namespace: namespace.to_s,
    execution: Temporalio::Api::Common::V1::WorkflowExecution.new(
      workflow_id: id,
      run_id: run_id || '',
    ),
    history_event_filter_type:
      Temporalio::Api::Enums::V1::HistoryEventFilterType::HISTORY_EVENT_FILTER_TYPE_CLOSE_EVENT,
    wait_new_event: true,
    skip_archival: true,
  )

  loop do
    response = connection.workflow_service.get_workflow_execution_history(request, **rpc_params)
    next_run_id = catch(:next) do
      # this will return out of the loop only if :next wasn't thrown
      return process_workflow_result_from(response, follow_runs)
    end
    request.execution&.run_id = next_run_id if next_run_id
  end
end

#cancel_workflow(input) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



49
50
51
52
53
# File 'lib/temporalio/client/implementation.rb', line 49

def cancel_workflow(input)
  interceptor_chain.invoke(:cancel_workflow, input) do |i|
    handle_cancel_workflow(i)
  end
end

#describe_workflow(input) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



31
32
33
34
35
# File 'lib/temporalio/client/implementation.rb', line 31

def describe_workflow(input)
  interceptor_chain.invoke(:describe_workflow, input) do |i|
    handle_describe_workflow(i)
  end
end

#query_workflow(input) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



37
38
39
40
41
# File 'lib/temporalio/client/implementation.rb', line 37

def query_workflow(input)
  interceptor_chain.invoke(:query_workflow, input) do |i|
    handle_query_workflow(i)
  end
end

#signal_workflow(input) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



43
44
45
46
47
# File 'lib/temporalio/client/implementation.rb', line 43

def signal_workflow(input)
  interceptor_chain.invoke(:signal_workflow, input) do |i|
    handle_signal_workflow(i)
  end
end

#start_workflow(input) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
28
29
# File 'lib/temporalio/client/implementation.rb', line 25

def start_workflow(input)
  interceptor_chain.invoke(:start_workflow, input) do |i|
    handle_start_workflow(i)
  end
end

#terminate_workflow(input) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



55
56
57
58
59
# File 'lib/temporalio/client/implementation.rb', line 55

def terminate_workflow(input)
  interceptor_chain.invoke(:terminate_workflow, input) do |i|
    handle_terminate_workflow(i)
  end
end