Class: Temporal::Client::Implementation
- Inherits:
-
Object
- Object
- Temporal::Client::Implementation
- Defined in:
- lib/temporal/client/implementation.rb
Instance Method Summary collapse
- #await_workflow_result(id, run_id, follow_runs, rpc_metadata, rpc_timeout) ⇒ Object
- #cancel_workflow(input) ⇒ Object
- #describe_workflow(input) ⇒ Object
-
#initialize(connection, namespace, converter, interceptors) ⇒ Implementation
constructor
A new instance of Implementation.
- #query_workflow(input) ⇒ Object
- #signal_workflow(input) ⇒ Object
- #start_workflow(input) ⇒ Object
- #terminate_workflow(input) ⇒ Object
Constructor Details
#initialize(connection, namespace, converter, interceptors) ⇒ Implementation
Returns a new instance of Implementation.
16 17 18 19 20 21 22 |
# File 'lib/temporal/client/implementation.rb', line 16 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
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/temporal/client/implementation.rb', line 60 def await_workflow_result(id, run_id, follow_runs, , rpc_timeout) rpc_params = { metadata: , timeout: rpc_timeout } request = Temporal::Api::WorkflowService::V1::GetWorkflowExecutionHistoryRequest.new( namespace: namespace.to_s, execution: Temporal::Api::Common::V1::WorkflowExecution.new( workflow_id: id, run_id: run_id || '', ), history_event_filter_type: Temporal::Api::Enums::V1::HistoryEventFilterType::HISTORY_EVENT_FILTER_TYPE_CLOSE_EVENT, wait_new_event: true, skip_archival: true, ) loop do response = connection.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
48 49 50 51 52 |
# File 'lib/temporal/client/implementation.rb', line 48 def cancel_workflow(input) interceptor_chain.invoke(:cancel_workflow, input) do |i| handle_cancel_workflow(i) end end |
#describe_workflow(input) ⇒ Object
30 31 32 33 34 |
# File 'lib/temporal/client/implementation.rb', line 30 def describe_workflow(input) interceptor_chain.invoke(:describe_workflow, input) do |i| handle_describe_workflow(i) end end |
#query_workflow(input) ⇒ Object
36 37 38 39 40 |
# File 'lib/temporal/client/implementation.rb', line 36 def query_workflow(input) interceptor_chain.invoke(:query_workflow, input) do |i| handle_query_workflow(i) end end |
#signal_workflow(input) ⇒ Object
42 43 44 45 46 |
# File 'lib/temporal/client/implementation.rb', line 42 def signal_workflow(input) interceptor_chain.invoke(:signal_workflow, input) do |i| handle_signal_workflow(i) end end |
#start_workflow(input) ⇒ Object
24 25 26 27 28 |
# File 'lib/temporal/client/implementation.rb', line 24 def start_workflow(input) interceptor_chain.invoke(:start_workflow, input) do |i| handle_start_workflow(i) end end |
#terminate_workflow(input) ⇒ Object
54 55 56 57 58 |
# File 'lib/temporal/client/implementation.rb', line 54 def terminate_workflow(input) interceptor_chain.invoke(:terminate_workflow, input) do |i| handle_terminate_workflow(i) end end |