temporalio 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +175 -4
- data/bridge/Cargo.lock +44 -21
- data/bridge/Cargo.toml +1 -0
- data/bridge/sdk-core/Cargo.toml +1 -1
- data/bridge/sdk-core/README.md +1 -4
- data/bridge/sdk-core/client/Cargo.toml +1 -1
- data/bridge/sdk-core/client/src/lib.rs +12 -20
- data/bridge/sdk-core/client/src/raw.rs +9 -8
- data/bridge/sdk-core/client/src/retry.rs +100 -23
- data/bridge/sdk-core/core/Cargo.toml +7 -7
- data/bridge/sdk-core/core/benches/workflow_replay.rs +13 -10
- data/bridge/sdk-core/core/src/abstractions.rs +22 -22
- data/bridge/sdk-core/core/src/core_tests/activity_tasks.rs +146 -43
- data/bridge/sdk-core/core/src/core_tests/local_activities.rs +419 -9
- data/bridge/sdk-core/core/src/core_tests/queries.rs +247 -89
- data/bridge/sdk-core/core/src/core_tests/workers.rs +2 -2
- data/bridge/sdk-core/core/src/core_tests/workflow_cancels.rs +1 -1
- data/bridge/sdk-core/core/src/core_tests/workflow_tasks.rs +47 -27
- data/bridge/sdk-core/core/src/lib.rs +139 -32
- data/bridge/sdk-core/core/src/protosext/mod.rs +1 -1
- data/bridge/sdk-core/core/src/replay/mod.rs +185 -41
- data/bridge/sdk-core/core/src/telemetry/log_export.rs +190 -0
- data/bridge/sdk-core/core/src/telemetry/metrics.rs +184 -139
- data/bridge/sdk-core/core/src/telemetry/mod.rs +310 -315
- data/bridge/sdk-core/core/src/telemetry/prometheus_server.rs +4 -3
- data/bridge/sdk-core/core/src/test_help/mod.rs +23 -9
- data/bridge/sdk-core/core/src/worker/activities/local_activities.rs +12 -6
- data/bridge/sdk-core/core/src/worker/activities.rs +40 -23
- data/bridge/sdk-core/core/src/worker/client/mocks.rs +1 -1
- data/bridge/sdk-core/core/src/worker/client.rs +30 -4
- data/bridge/sdk-core/core/src/worker/mod.rs +23 -19
- data/bridge/sdk-core/core/src/worker/workflow/driven_workflow.rs +10 -19
- data/bridge/sdk-core/core/src/worker/workflow/history_update.rs +99 -25
- data/bridge/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +1 -5
- data/bridge/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +1 -5
- data/bridge/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +1 -5
- data/bridge/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +3 -5
- data/bridge/sdk-core/core/src/worker/workflow/machines/complete_workflow_state_machine.rs +1 -5
- data/bridge/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +2 -6
- data/bridge/sdk-core/core/src/worker/workflow/machines/fail_workflow_state_machine.rs +1 -5
- data/bridge/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +24 -22
- data/bridge/sdk-core/core/src/worker/workflow/machines/mod.rs +12 -38
- data/bridge/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +178 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +1 -5
- data/bridge/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +1 -5
- data/bridge/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +1 -5
- data/bridge/sdk-core/core/src/worker/workflow/machines/transition_coverage.rs +8 -2
- data/bridge/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +1 -5
- data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_machines/local_acts.rs +1 -1
- data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +233 -217
- data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_task_state_machine.rs +1 -6
- data/bridge/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +4 -4
- data/bridge/sdk-core/core/src/worker/workflow/managed_run.rs +13 -5
- data/bridge/sdk-core/core/src/worker/workflow/mod.rs +86 -29
- data/bridge/sdk-core/core/src/worker/workflow/wft_poller.rs +2 -2
- data/bridge/sdk-core/core/src/worker/workflow/workflow_stream.rs +56 -11
- data/bridge/sdk-core/core-api/Cargo.toml +4 -3
- data/bridge/sdk-core/core-api/src/lib.rs +1 -43
- data/bridge/sdk-core/core-api/src/telemetry.rs +147 -0
- data/bridge/sdk-core/core-api/src/worker.rs +13 -0
- data/bridge/sdk-core/etc/deps.svg +115 -140
- data/bridge/sdk-core/etc/regen-depgraph.sh +5 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +1 -1
- data/bridge/sdk-core/histories/evict_while_la_running_no_interference-23_history.bin +0 -0
- data/bridge/sdk-core/histories/evict_while_la_running_no_interference-85_history.bin +0 -0
- data/bridge/sdk-core/protos/api_upstream/buf.yaml +0 -3
- data/bridge/sdk-core/protos/api_upstream/build/go.mod +7 -0
- data/bridge/sdk-core/protos/api_upstream/build/go.sum +5 -0
- data/bridge/sdk-core/protos/api_upstream/{temporal/api/update/v1/message.proto → build/tools.go} +6 -23
- data/bridge/sdk-core/protos/api_upstream/go.mod +6 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/batch/v1/message.proto +12 -9
- data/bridge/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +20 -19
- data/bridge/sdk-core/protos/api_upstream/temporal/api/common/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/batch_operation.proto +3 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/command_type.proto +4 -4
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/common.proto +3 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/event_type.proto +5 -3
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +23 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/{cluster.proto → interaction_type.proto} +10 -11
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/namespace.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/query.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/reset.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/schedule.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/update.proto +2 -13
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/workflow.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/errordetails/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/failure/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/filter/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +26 -19
- data/bridge/sdk-core/protos/api_upstream/temporal/api/interaction/v1/message.proto +87 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/namespace/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +21 -61
- data/bridge/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +2 -21
- data/bridge/sdk-core/protos/api_upstream/temporal/api/query/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/replication/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/schedule/v1/message.proto +110 -31
- data/bridge/sdk-core/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +4 -4
- data/bridge/sdk-core/protos/api_upstream/temporal/api/version/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/workflow/v1/message.proto +3 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +60 -16
- data/bridge/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +17 -3
- data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +2 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +8 -1
- data/bridge/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/request_response.proto +2 -2
- data/bridge/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto +2 -2
- data/bridge/sdk-core/sdk/Cargo.toml +2 -2
- data/bridge/sdk-core/sdk/src/interceptors.rs +36 -3
- data/bridge/sdk-core/sdk/src/lib.rs +7 -5
- data/bridge/sdk-core/sdk/src/workflow_context.rs +13 -2
- data/bridge/sdk-core/sdk/src/workflow_future.rs +3 -7
- data/bridge/sdk-core/sdk-core-protos/Cargo.toml +1 -1
- data/bridge/sdk-core/sdk-core-protos/build.rs +0 -1
- data/bridge/sdk-core/sdk-core-protos/src/history_builder.rs +65 -18
- data/bridge/sdk-core/sdk-core-protos/src/history_info.rs +22 -22
- data/bridge/sdk-core/sdk-core-protos/src/lib.rs +104 -44
- data/bridge/sdk-core/test-utils/Cargo.toml +2 -1
- data/bridge/sdk-core/test-utils/src/lib.rs +81 -29
- data/bridge/sdk-core/tests/integ_tests/heartbeat_tests.rs +5 -2
- data/bridge/sdk-core/tests/integ_tests/metrics_tests.rs +37 -0
- data/bridge/sdk-core/tests/integ_tests/polling_tests.rs +0 -13
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +167 -13
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +53 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/replay.rs +106 -20
- data/bridge/sdk-core/tests/integ_tests/workflow_tests.rs +18 -8
- data/bridge/sdk-core/tests/main.rs +6 -4
- data/bridge/src/connection.rs +81 -62
- data/bridge/src/lib.rs +92 -33
- data/bridge/src/runtime.rs +9 -2
- data/bridge/src/worker.rs +53 -2
- data/lib/bridge.so +0 -0
- data/lib/gen/temporal/api/batch/v1/message_pb.rb +8 -6
- data/lib/gen/temporal/api/command/v1/message_pb.rb +17 -9
- data/lib/gen/temporal/api/common/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/enums/v1/batch_operation_pb.rb +2 -1
- data/lib/gen/temporal/api/enums/v1/command_type_pb.rb +3 -1
- data/lib/gen/temporal/api/enums/v1/common_pb.rb +2 -1
- data/lib/gen/temporal/api/enums/v1/event_type_pb.rb +3 -2
- data/lib/gen/temporal/api/enums/v1/failed_cause_pb.rb +7 -1
- data/lib/gen/temporal/api/enums/v1/interaction_type_pb.rb +25 -0
- data/lib/gen/temporal/api/enums/v1/namespace_pb.rb +1 -1
- data/lib/gen/temporal/api/enums/v1/query_pb.rb +1 -1
- data/lib/gen/temporal/api/enums/v1/reset_pb.rb +1 -1
- data/lib/gen/temporal/api/enums/v1/schedule_pb.rb +1 -1
- data/lib/gen/temporal/api/enums/v1/task_queue_pb.rb +1 -1
- data/lib/gen/temporal/api/enums/v1/update_pb.rb +1 -6
- data/lib/gen/temporal/api/enums/v1/workflow_pb.rb +1 -1
- data/lib/gen/temporal/api/errordetails/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/failure/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/filter/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/history/v1/message_pb.rb +19 -18
- data/lib/gen/temporal/api/interaction/v1/message_pb.rb +49 -0
- data/lib/gen/temporal/api/namespace/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/operatorservice/v1/request_response_pb.rb +11 -51
- data/lib/gen/temporal/api/operatorservice/v1/service_pb.rb +1 -1
- data/lib/gen/temporal/api/query/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/replication/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/schedule/v1/message_pb.rb +22 -1
- data/lib/gen/temporal/api/taskqueue/v1/message_pb.rb +2 -2
- data/lib/gen/temporal/api/version/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/workflow/v1/message_pb.rb +2 -1
- data/lib/gen/temporal/api/workflowservice/v1/request_response_pb.rb +27 -10
- data/lib/gen/temporal/api/workflowservice/v1/service_pb.rb +1 -1
- data/lib/gen/temporal/sdk/core/workflow_activation/workflow_activation_pb.rb +1 -0
- data/lib/gen/temporal/sdk/core/workflow_commands/workflow_commands_pb.rb +5 -1
- data/lib/temporalio/activity/context.rb +97 -0
- data/lib/temporalio/activity/info.rb +67 -0
- data/lib/temporalio/activity.rb +85 -0
- data/lib/temporalio/bridge/error.rb +8 -0
- data/lib/temporalio/bridge.rb +14 -0
- data/lib/{temporal → temporalio}/client/implementation.rb +49 -48
- data/lib/{temporal → temporalio}/client/workflow_handle.rb +35 -35
- data/lib/{temporal → temporalio}/client.rb +19 -32
- data/lib/{temporal → temporalio}/connection.rb +238 -223
- data/lib/{temporal → temporalio}/data_converter.rb +76 -35
- data/lib/{temporal → temporalio}/error/failure.rb +6 -6
- data/lib/{temporal → temporalio}/error/workflow_failure.rb +4 -2
- data/lib/{temporal → temporalio}/errors.rb +19 -1
- data/lib/{temporal → temporalio}/failure_converter/base.rb +5 -5
- data/lib/{temporal → temporalio}/failure_converter/basic.rb +58 -52
- data/lib/temporalio/failure_converter.rb +7 -0
- data/lib/{temporal → temporalio}/interceptor/chain.rb +2 -1
- data/lib/{temporal → temporalio}/interceptor/client.rb +22 -1
- data/lib/{temporal → temporalio}/payload_codec/base.rb +5 -5
- data/lib/{temporal → temporalio}/payload_converter/base.rb +3 -3
- data/lib/{temporal → temporalio}/payload_converter/bytes.rb +4 -3
- data/lib/{temporal → temporalio}/payload_converter/composite.rb +7 -5
- data/lib/{temporal → temporalio}/payload_converter/encoding_base.rb +4 -4
- data/lib/{temporal → temporalio}/payload_converter/json.rb +4 -3
- data/lib/{temporal → temporalio}/payload_converter/nil.rb +4 -3
- data/lib/temporalio/payload_converter.rb +14 -0
- data/lib/{temporal → temporalio}/retry_policy.rb +4 -4
- data/lib/{temporal → temporalio}/retry_state.rb +1 -1
- data/lib/temporalio/runtime.rb +25 -0
- data/lib/{temporal → temporalio}/timeout_type.rb +2 -2
- data/lib/temporalio/version.rb +3 -0
- data/lib/temporalio/worker/activity_runner.rb +92 -0
- data/lib/temporalio/worker/activity_worker.rb +138 -0
- data/lib/temporalio/worker/reactor.rb +46 -0
- data/lib/temporalio/worker/runner.rb +63 -0
- data/lib/temporalio/worker/sync_worker.rb +88 -0
- data/lib/temporalio/worker/thread_pool_executor.rb +51 -0
- data/lib/temporalio/worker.rb +198 -0
- data/lib/{temporal → temporalio}/workflow/execution_info.rb +4 -4
- data/lib/{temporal → temporalio}/workflow/execution_status.rb +1 -1
- data/lib/{temporal → temporalio}/workflow/id_reuse_policy.rb +6 -6
- data/lib/{temporal → temporalio}/workflow/query_reject_condition.rb +5 -5
- data/lib/temporalio.rb +12 -3
- data/temporalio.gemspec +7 -3
- metadata +79 -56
- data/bridge/sdk-core/bridge-ffi/Cargo.toml +0 -24
- data/bridge/sdk-core/bridge-ffi/LICENSE.txt +0 -23
- data/bridge/sdk-core/bridge-ffi/build.rs +0 -25
- data/bridge/sdk-core/bridge-ffi/include/sdk-core-bridge.h +0 -249
- data/bridge/sdk-core/bridge-ffi/src/lib.rs +0 -825
- data/bridge/sdk-core/bridge-ffi/src/wrappers.rs +0 -211
- data/bridge/sdk-core/core/src/log_export.rs +0 -62
- data/bridge/sdk-core/core/src/worker/workflow/machines/mutable_side_effect_state_machine.rs +0 -127
- data/bridge/sdk-core/core/src/worker/workflow/machines/side_effect_state_machine.rs +0 -71
- data/bridge/sdk-core/protos/api_upstream/temporal/api/cluster/v1/message.proto +0 -83
- data/bridge/sdk-core/protos/local/temporal/sdk/core/bridge/bridge.proto +0 -210
- data/bridge/sdk-core/sdk/src/conversions.rs +0 -8
- data/lib/gen/temporal/api/cluster/v1/message_pb.rb +0 -67
- data/lib/gen/temporal/api/enums/v1/cluster_pb.rb +0 -26
- data/lib/gen/temporal/api/update/v1/message_pb.rb +0 -26
- data/lib/temporal/bridge.rb +0 -14
- data/lib/temporal/failure_converter.rb +0 -8
- data/lib/temporal/payload_converter.rb +0 -14
- data/lib/temporal/runtime.rb +0 -22
- data/lib/temporal/version.rb +0 -3
- data/lib/temporal.rb +0 -8
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
require 'socket'
|
|
2
2
|
require 'temporal/api/workflowservice/v1/request_response_pb'
|
|
3
|
-
require '
|
|
4
|
-
require '
|
|
5
|
-
require '
|
|
6
|
-
require '
|
|
7
|
-
require '
|
|
8
|
-
require '
|
|
9
|
-
require '
|
|
10
|
-
require '
|
|
11
|
-
require '
|
|
12
|
-
|
|
13
|
-
module
|
|
3
|
+
require 'temporalio/client/workflow_handle'
|
|
4
|
+
require 'temporalio/error/failure'
|
|
5
|
+
require 'temporalio/error/workflow_failure'
|
|
6
|
+
require 'temporalio/interceptor/chain'
|
|
7
|
+
require 'temporalio/timeout_type'
|
|
8
|
+
require 'temporalio/version'
|
|
9
|
+
require 'temporalio/workflow/execution_info'
|
|
10
|
+
require 'temporalio/workflow/id_reuse_policy'
|
|
11
|
+
require 'temporalio/workflow/query_reject_condition'
|
|
12
|
+
|
|
13
|
+
module Temporalio
|
|
14
14
|
class Client
|
|
15
|
+
# @api private
|
|
15
16
|
class Implementation
|
|
16
17
|
def initialize(connection, namespace, converter, interceptors)
|
|
17
18
|
@connection = connection
|
|
@@ -59,14 +60,14 @@ module Temporal
|
|
|
59
60
|
|
|
60
61
|
def await_workflow_result(id, run_id, follow_runs, rpc_metadata, rpc_timeout)
|
|
61
62
|
rpc_params = { metadata: rpc_metadata, timeout: rpc_timeout }
|
|
62
|
-
request =
|
|
63
|
+
request = Temporalio::Api::WorkflowService::V1::GetWorkflowExecutionHistoryRequest.new(
|
|
63
64
|
namespace: namespace.to_s,
|
|
64
|
-
execution:
|
|
65
|
+
execution: Temporalio::Api::Common::V1::WorkflowExecution.new(
|
|
65
66
|
workflow_id: id,
|
|
66
67
|
run_id: run_id || '',
|
|
67
68
|
),
|
|
68
69
|
history_event_filter_type:
|
|
69
|
-
|
|
70
|
+
Temporalio::Api::Enums::V1::HistoryEventFilterType::HISTORY_EVENT_FILTER_TYPE_CLOSE_EVENT,
|
|
70
71
|
wait_new_event: true,
|
|
71
72
|
skip_archival: true,
|
|
72
73
|
)
|
|
@@ -88,7 +89,7 @@ module Temporal
|
|
|
88
89
|
def convert_headers(headers)
|
|
89
90
|
return if headers.empty?
|
|
90
91
|
|
|
91
|
-
|
|
92
|
+
Temporalio::Api::Common::V1::Header.new(
|
|
92
93
|
fields: converter.to_payload_map(headers),
|
|
93
94
|
)
|
|
94
95
|
end
|
|
@@ -97,11 +98,11 @@ module Temporal
|
|
|
97
98
|
input.retry_policy&.validate!
|
|
98
99
|
|
|
99
100
|
if input.memo
|
|
100
|
-
memo =
|
|
101
|
+
memo = Temporalio::Api::Common::V1::Memo.new(fields: converter.to_payload_map(input.memo))
|
|
101
102
|
end
|
|
102
103
|
|
|
103
104
|
if input.search_attributes
|
|
104
|
-
search_attributes =
|
|
105
|
+
search_attributes = Temporalio::Api::Common::V1::SearchAttributes.new(
|
|
105
106
|
indexed_fields: converter.to_payload_map(input.search_attributes),
|
|
106
107
|
)
|
|
107
108
|
end
|
|
@@ -111,9 +112,9 @@ module Temporal
|
|
|
111
112
|
identity: identity,
|
|
112
113
|
request_id: SecureRandom.uuid,
|
|
113
114
|
namespace: namespace,
|
|
114
|
-
workflow_type:
|
|
115
|
+
workflow_type: Temporalio::Api::Common::V1::WorkflowType.new(name: input.workflow.to_s),
|
|
115
116
|
workflow_id: input.id,
|
|
116
|
-
task_queue:
|
|
117
|
+
task_queue: Temporalio::Api::TaskQueue::V1::TaskQueue.new(name: input.task_queue.to_s),
|
|
117
118
|
input: converter.to_payloads(input.args),
|
|
118
119
|
workflow_execution_timeout: input.execution_timeout,
|
|
119
120
|
workflow_run_timeout: input.run_timeout,
|
|
@@ -133,12 +134,12 @@ module Temporal
|
|
|
133
134
|
signal_input: converter.to_payloads(input.start_signal_args),
|
|
134
135
|
)
|
|
135
136
|
|
|
136
|
-
klass =
|
|
137
|
+
klass = Temporalio::Api::WorkflowService::V1::SignalWithStartWorkflowExecutionRequest
|
|
137
138
|
request = klass.new(**params)
|
|
138
139
|
|
|
139
140
|
response = connection.signal_with_start_workflow_execution(request, **rpc_params)
|
|
140
141
|
else
|
|
141
|
-
klass =
|
|
142
|
+
klass = Temporalio::Api::WorkflowService::V1::StartWorkflowExecutionRequest
|
|
142
143
|
request = klass.new(**params)
|
|
143
144
|
|
|
144
145
|
response = connection.start_workflow_execution(request, **rpc_params)
|
|
@@ -151,10 +152,10 @@ module Temporal
|
|
|
151
152
|
result_run_id: response.run_id,
|
|
152
153
|
first_execution_run_id: first_execution_run_id,
|
|
153
154
|
)
|
|
154
|
-
rescue
|
|
155
|
+
rescue Temporalio::Bridge::Error => e
|
|
155
156
|
# TODO: Raise a better error from the bridge
|
|
156
157
|
if e.message.include?('AlreadyExists')
|
|
157
|
-
raise
|
|
158
|
+
raise Temporalio::Error::WorkflowExecutionAlreadyStarted, 'Workflow execution already started'
|
|
158
159
|
else
|
|
159
160
|
raise # re-raise
|
|
160
161
|
end
|
|
@@ -162,9 +163,9 @@ module Temporal
|
|
|
162
163
|
|
|
163
164
|
def handle_describe_workflow(input)
|
|
164
165
|
rpc_params = { metadata: input.rpc_metadata, timeout: input.rpc_timeout }
|
|
165
|
-
request =
|
|
166
|
+
request = Temporalio::Api::WorkflowService::V1::DescribeWorkflowExecutionRequest.new(
|
|
166
167
|
namespace: namespace.to_s,
|
|
167
|
-
execution:
|
|
168
|
+
execution: Temporalio::Api::Common::V1::WorkflowExecution.new(
|
|
168
169
|
workflow_id: input.id,
|
|
169
170
|
run_id: input.run_id || '',
|
|
170
171
|
),
|
|
@@ -177,13 +178,13 @@ module Temporal
|
|
|
177
178
|
|
|
178
179
|
def handle_query_workflow(input)
|
|
179
180
|
rpc_params = { metadata: input.rpc_metadata, timeout: input.rpc_timeout }
|
|
180
|
-
request =
|
|
181
|
+
request = Temporalio::Api::WorkflowService::V1::QueryWorkflowRequest.new(
|
|
181
182
|
namespace: namespace.to_s,
|
|
182
|
-
execution:
|
|
183
|
+
execution: Temporalio::Api::Common::V1::WorkflowExecution.new(
|
|
183
184
|
workflow_id: input.id,
|
|
184
185
|
run_id: input.run_id,
|
|
185
186
|
),
|
|
186
|
-
query:
|
|
187
|
+
query: Temporalio::Api::Query::V1::WorkflowQuery.new(
|
|
187
188
|
query_type: input.query.to_s,
|
|
188
189
|
query_args: converter.to_payloads(input.args),
|
|
189
190
|
header: convert_headers(input.headers),
|
|
@@ -195,22 +196,22 @@ module Temporal
|
|
|
195
196
|
|
|
196
197
|
if response.query_rejected
|
|
197
198
|
status = Workflow::ExecutionStatus.from_raw(response.query_rejected.status)
|
|
198
|
-
raise
|
|
199
|
+
raise Temporalio::Error::QueryRejected, status
|
|
199
200
|
end
|
|
200
201
|
|
|
201
202
|
converter.from_payloads(response.query_result)&.first
|
|
202
|
-
rescue
|
|
203
|
+
rescue Temporalio::Bridge::Error => e
|
|
203
204
|
# TODO: Raise a better error from the bridge
|
|
204
|
-
raise
|
|
205
|
+
raise Temporalio::Error::QueryFailed, e.message
|
|
205
206
|
end
|
|
206
207
|
|
|
207
208
|
def handle_signal_workflow(input)
|
|
208
209
|
rpc_params = { metadata: input.rpc_metadata, timeout: input.rpc_timeout }
|
|
209
|
-
request =
|
|
210
|
+
request = Temporalio::Api::WorkflowService::V1::SignalWorkflowExecutionRequest.new(
|
|
210
211
|
identity: identity,
|
|
211
212
|
request_id: SecureRandom.uuid,
|
|
212
213
|
namespace: namespace.to_s,
|
|
213
|
-
workflow_execution:
|
|
214
|
+
workflow_execution: Temporalio::Api::Common::V1::WorkflowExecution.new(
|
|
214
215
|
workflow_id: input.id,
|
|
215
216
|
run_id: input.run_id || '',
|
|
216
217
|
),
|
|
@@ -226,11 +227,11 @@ module Temporal
|
|
|
226
227
|
|
|
227
228
|
def handle_cancel_workflow(input)
|
|
228
229
|
rpc_params = { metadata: input.rpc_metadata, timeout: input.rpc_timeout }
|
|
229
|
-
request =
|
|
230
|
+
request = Temporalio::Api::WorkflowService::V1::RequestCancelWorkflowExecutionRequest.new(
|
|
230
231
|
identity: identity,
|
|
231
232
|
request_id: SecureRandom.uuid,
|
|
232
233
|
namespace: namespace.to_s,
|
|
233
|
-
workflow_execution:
|
|
234
|
+
workflow_execution: Temporalio::Api::Common::V1::WorkflowExecution.new(
|
|
234
235
|
workflow_id: input.id,
|
|
235
236
|
run_id: input.run_id || '',
|
|
236
237
|
),
|
|
@@ -245,10 +246,10 @@ module Temporal
|
|
|
245
246
|
|
|
246
247
|
def handle_terminate_workflow(input)
|
|
247
248
|
rpc_params = { metadata: input.rpc_metadata, timeout: input.rpc_timeout }
|
|
248
|
-
request =
|
|
249
|
+
request = Temporalio::Api::WorkflowService::V1::TerminateWorkflowExecutionRequest.new(
|
|
249
250
|
identity: identity,
|
|
250
251
|
namespace: namespace.to_s,
|
|
251
|
-
workflow_execution:
|
|
252
|
+
workflow_execution: Temporalio::Api::Common::V1::WorkflowExecution.new(
|
|
252
253
|
workflow_id: input.id,
|
|
253
254
|
run_id: input.run_id || '',
|
|
254
255
|
),
|
|
@@ -268,11 +269,11 @@ module Temporal
|
|
|
268
269
|
if !events || events.empty?
|
|
269
270
|
throw(:next, nil) # next loop, same run_id
|
|
270
271
|
elsif events.length != 1
|
|
271
|
-
raise
|
|
272
|
+
raise Temporalio::Error, "Expected single close event, got #{events.length}"
|
|
272
273
|
end
|
|
273
274
|
|
|
274
275
|
event = events.first
|
|
275
|
-
raise
|
|
276
|
+
raise Temporalio::Error::UnexpectedResponse, 'Missing final history event' unless event
|
|
276
277
|
|
|
277
278
|
case event.event_type
|
|
278
279
|
when :EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED
|
|
@@ -286,15 +287,15 @@ module Temporal
|
|
|
286
287
|
attributes = event.workflow_execution_failed_event_attributes
|
|
287
288
|
follow(attributes&.new_execution_run_id) if follow_runs
|
|
288
289
|
|
|
289
|
-
raise
|
|
290
|
+
raise Temporalio::Error::WorkflowFailure.new(
|
|
290
291
|
cause: converter.from_failure(attributes&.failure),
|
|
291
292
|
)
|
|
292
293
|
|
|
293
294
|
when :EVENT_TYPE_WORKFLOW_EXECUTION_CANCELED
|
|
294
295
|
attributes = event.workflow_execution_canceled_event_attributes
|
|
295
296
|
|
|
296
|
-
raise
|
|
297
|
-
cause:
|
|
297
|
+
raise Temporalio::Error::WorkflowFailure.new(
|
|
298
|
+
cause: Temporalio::Error::CancelledError.new(
|
|
298
299
|
'Workflow execution cancelled',
|
|
299
300
|
details: converter.from_payloads(attributes&.details),
|
|
300
301
|
),
|
|
@@ -303,8 +304,8 @@ module Temporal
|
|
|
303
304
|
when :EVENT_TYPE_WORKFLOW_EXECUTION_TERMINATED
|
|
304
305
|
attributes = event.workflow_execution_terminated_event_attributes
|
|
305
306
|
|
|
306
|
-
raise
|
|
307
|
-
cause:
|
|
307
|
+
raise Temporalio::Error::WorkflowFailure.new(
|
|
308
|
+
cause: Temporalio::Error::TerminatedError.new(
|
|
308
309
|
attributes&.reason || 'Workflow execution terminated',
|
|
309
310
|
),
|
|
310
311
|
)
|
|
@@ -313,10 +314,10 @@ module Temporal
|
|
|
313
314
|
attributes = event.workflow_execution_timed_out_event_attributes
|
|
314
315
|
follow(attributes&.new_execution_run_id) if follow_runs
|
|
315
316
|
|
|
316
|
-
raise
|
|
317
|
-
cause:
|
|
317
|
+
raise Temporalio::Error::WorkflowFailure.new(
|
|
318
|
+
cause: Temporalio::Error::TimeoutError.new(
|
|
318
319
|
'Workflow execution timed out',
|
|
319
|
-
type:
|
|
320
|
+
type: Temporalio::TimeoutType::START_TO_CLOSE,
|
|
320
321
|
),
|
|
321
322
|
)
|
|
322
323
|
|
|
@@ -325,7 +326,7 @@ module Temporal
|
|
|
325
326
|
follow(attributes&.new_execution_run_id) if follow_runs
|
|
326
327
|
|
|
327
328
|
# TODO: Use more specific error and decode failure
|
|
328
|
-
raise
|
|
329
|
+
raise Temporalio::Error, 'Workflow execution continued as new'
|
|
329
330
|
end
|
|
330
331
|
end
|
|
331
332
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
require '
|
|
2
|
-
require '
|
|
1
|
+
require 'temporalio/interceptor/client'
|
|
2
|
+
require 'temporalio/workflow/query_reject_condition'
|
|
3
3
|
|
|
4
|
-
module
|
|
4
|
+
module Temporalio
|
|
5
5
|
class Client
|
|
6
6
|
# Handle for interacting with a workflow.
|
|
7
7
|
#
|
|
8
|
-
# This is usually created via {
|
|
9
|
-
# from {
|
|
8
|
+
# This is usually created via {Temporalio::Client#workflow_handle} or returned
|
|
9
|
+
# from {Temporalio::Client#start_workflow}.
|
|
10
10
|
class WorkflowHandle
|
|
11
11
|
# @return [String] ID for the workflow.
|
|
12
12
|
attr_reader :id
|
|
@@ -14,10 +14,10 @@ module Temporal
|
|
|
14
14
|
# Run ID used for {#signal} and {#query} calls if present to ensure the query or signal happen
|
|
15
15
|
# on this exact run.
|
|
16
16
|
#
|
|
17
|
-
# This is only set on handles created via {
|
|
18
|
-
# parameter. {
|
|
17
|
+
# This is only set on handles created via {Temporalio::Client#workflow_handle} with a `run_id`
|
|
18
|
+
# parameter. {Temporalio::Client#start_workflow} does not set this value.
|
|
19
19
|
#
|
|
20
|
-
# This cannot be mutated. If a different run ID is needed, {
|
|
20
|
+
# This cannot be mutated. If a different run ID is needed, {Temporalio::Client#workflow_handle}
|
|
21
21
|
# must be used instead.
|
|
22
22
|
#
|
|
23
23
|
# @return [String]
|
|
@@ -26,11 +26,11 @@ module Temporal
|
|
|
26
26
|
# Run ID used for {#result} calls if present to ensure result is for a workflow starting from
|
|
27
27
|
# this run.
|
|
28
28
|
#
|
|
29
|
-
# When this handle is created via {
|
|
30
|
-
# `:run_id`. When this handle is created via {
|
|
29
|
+
# When this handle is created via {Temporalio::Client#workflow_handle}, this is the same as
|
|
30
|
+
# `:run_id`. When this handle is created via {Temporalio::Client#start_workflow}, this value
|
|
31
31
|
# will be the resulting run ID.
|
|
32
32
|
#
|
|
33
|
-
# This cannot be mutated. If a different run ID is needed, {
|
|
33
|
+
# This cannot be mutated. If a different run ID is needed, {Temporalio::Client#workflow_handle}
|
|
34
34
|
# must be used instead.
|
|
35
35
|
#
|
|
36
36
|
# @return [String]
|
|
@@ -39,12 +39,12 @@ module Temporal
|
|
|
39
39
|
# Run ID used for {#cancel} and {#terminate} calls if present to ensure the cancel and
|
|
40
40
|
# terminate happen for a workflow ID started with this run ID.
|
|
41
41
|
#
|
|
42
|
-
# This can be set when using {
|
|
43
|
-
# {
|
|
42
|
+
# This can be set when using {Temporalio::Client#workflow_handle}. When
|
|
43
|
+
# {Temporalio::Client#start_workflow} is called without a start signal, this is set to the
|
|
44
44
|
# resulting run.
|
|
45
45
|
#
|
|
46
46
|
# This cannot be mutated. If a different first execution run ID is needed,
|
|
47
|
-
# {
|
|
47
|
+
# {Temporalio::Client#workflow_handle} must be used instead.
|
|
48
48
|
#
|
|
49
49
|
# @return [String]
|
|
50
50
|
attr_reader :first_execution_run_id
|
|
@@ -60,7 +60,7 @@ module Temporal
|
|
|
60
60
|
# Wait for result of the workflow.
|
|
61
61
|
#
|
|
62
62
|
# This will use {#result_run_id} if present to base the result on. To use another run ID,
|
|
63
|
-
# a new handle must be created via {
|
|
63
|
+
# a new handle must be created via {Temporalio::Client#workflow_handle}.
|
|
64
64
|
#
|
|
65
65
|
# @param follow_runs [Bool] If true (default), workflow runs will be continually fetched,
|
|
66
66
|
# until the most recent one is found. If false, the first result is used.
|
|
@@ -71,8 +71,8 @@ module Temporal
|
|
|
71
71
|
#
|
|
72
72
|
# @return [any] Result of the workflow after being converted by the data converter.
|
|
73
73
|
#
|
|
74
|
-
# @raise [
|
|
75
|
-
# timed out. Use the {
|
|
74
|
+
# @raise [Temporalio::Error::WorkflowFailure] Workflow failed, was cancelled, was terminated, or
|
|
75
|
+
# timed out. Use the {Temporalio::Error::WorkflowFailure#cause} to see the underlying reason.
|
|
76
76
|
# @raise [StandardError] Other possible failures during result fetching.
|
|
77
77
|
def result(follow_runs: true, rpc_metadata: {}, rpc_timeout: nil)
|
|
78
78
|
client_impl.await_workflow_result(id, result_run_id, follow_runs, rpc_metadata, rpc_timeout)
|
|
@@ -81,9 +81,9 @@ module Temporal
|
|
|
81
81
|
# Get workflow details.
|
|
82
82
|
#
|
|
83
83
|
# This will get details for {#run_id} if present. To use a different run ID, create a new
|
|
84
|
-
# handle with via {
|
|
84
|
+
# handle with via {Temporalio::Client#workflow_handle}.
|
|
85
85
|
#
|
|
86
|
-
# @note Handles created as a result of {
|
|
86
|
+
# @note Handles created as a result of {Temporalio::Client#start_workflow} will describe the
|
|
87
87
|
# latest workflow with the same workflow ID even if it is unrelated to the started workflow.
|
|
88
88
|
#
|
|
89
89
|
# @param rpc_metadata [Hash<String, String>] Headers used on the RPC call.
|
|
@@ -91,9 +91,9 @@ module Temporal
|
|
|
91
91
|
# @param rpc_timeout [Integer] Optional RPC deadline to set for each RPC call. Note, this is
|
|
92
92
|
# the timeout for each history RPC call not this overall function.
|
|
93
93
|
#
|
|
94
|
-
# @return [
|
|
94
|
+
# @return [Temporalio::Workflow::ExecutionInfo] Workflow details.
|
|
95
95
|
#
|
|
96
|
-
# @raise [
|
|
96
|
+
# @raise [Temporalio::Error::RPCError] Workflow details could not be fetched.
|
|
97
97
|
def describe(rpc_metadata: {}, rpc_timeout: nil)
|
|
98
98
|
input = Interceptor::Client::DescribeWorkflowInput.new(
|
|
99
99
|
id: id,
|
|
@@ -109,9 +109,9 @@ module Temporal
|
|
|
109
109
|
#
|
|
110
110
|
# This will issue a cancellation for {#run_id} if present. This call will make sure to use the
|
|
111
111
|
# run chain starting from {#first_execution_run_id} if present. To create handles with these
|
|
112
|
-
# values, use {
|
|
112
|
+
# values, use {Temporalio::Client#workflow_handle}.
|
|
113
113
|
#
|
|
114
|
-
# @note Handles created as a result of {
|
|
114
|
+
# @note Handles created as a result of {Temporalio::Client#start_workflow} with a start signal
|
|
115
115
|
# will cancel the latest workflow with the same workflow ID even if it is unrelated to the
|
|
116
116
|
# started workflow.
|
|
117
117
|
#
|
|
@@ -120,7 +120,7 @@ module Temporal
|
|
|
120
120
|
# Keys here override client-level RPC metadata keys.
|
|
121
121
|
# @param rpc_timeout [Integer] Optional RPC deadline to set for each RPC call.
|
|
122
122
|
#
|
|
123
|
-
# @raise [
|
|
123
|
+
# @raise [Temporalio::Error::RPCError] Workflow could not be cancelled.
|
|
124
124
|
def cancel(reason = nil, rpc_metadata: {}, rpc_timeout: nil)
|
|
125
125
|
input = Interceptor::Client::CancelWorkflowInput.new(
|
|
126
126
|
id: id,
|
|
@@ -137,23 +137,23 @@ module Temporal
|
|
|
137
137
|
# Query the workflow.
|
|
138
138
|
#
|
|
139
139
|
# This will query for {#run_id} if present. To use a different run ID, create a new handle
|
|
140
|
-
# with via {
|
|
140
|
+
# with via {Temporalio::Client#workflow_handle}.
|
|
141
141
|
#
|
|
142
|
-
# @note Handles created as a result of {
|
|
142
|
+
# @note Handles created as a result of {Temporalio::Client#start_workflow} will query the latest
|
|
143
143
|
# workflow with the same workflow ID even if it is unrelated to the started workflow.
|
|
144
144
|
#
|
|
145
145
|
# @param query [String, Symbol] Query function or name on the workflow.
|
|
146
146
|
# @param args [any] Arguments to the query.
|
|
147
147
|
# @param reject_condition [Symbol] Condition for rejecting the query. Refer to
|
|
148
|
-
# {
|
|
148
|
+
# {Temporalio::Workflow::QueryRejectCondition} for the list of allowed values.
|
|
149
149
|
# @param rpc_metadata [Hash<String, String>] Headers used on the RPC call.
|
|
150
150
|
# Keys here override client-level RPC metadata keys.
|
|
151
151
|
# @param rpc_timeout [Integer] Optional RPC deadline to set for each RPC call.
|
|
152
152
|
#
|
|
153
153
|
# @return [any] Result of the query.
|
|
154
154
|
#
|
|
155
|
-
# @raise [
|
|
156
|
-
# @raise [
|
|
155
|
+
# @raise [Temporalio::Error] A query reject condition was satisfied.
|
|
156
|
+
# @raise [Temporalio::Error::RPCError] Workflow details could not be fetched.
|
|
157
157
|
def query(
|
|
158
158
|
query,
|
|
159
159
|
*args,
|
|
@@ -178,9 +178,9 @@ module Temporal
|
|
|
178
178
|
# Send a signal to the workflow.
|
|
179
179
|
#
|
|
180
180
|
# This will signal for {#run_id} if present. To use a different run ID, create a new handle
|
|
181
|
-
# with via {
|
|
181
|
+
# with via {Temporalio::Client#workflow_handle}.
|
|
182
182
|
#
|
|
183
|
-
# @note Handles created as a result of {
|
|
183
|
+
# @note Handles created as a result of {Temporalio::Client#start_workflow} will signal the
|
|
184
184
|
# latest workflow with the same workflow ID even if it is unrelated to the started workflow.
|
|
185
185
|
#
|
|
186
186
|
# @param signal [String, Symbol] Signal function or name on the workflow.
|
|
@@ -189,7 +189,7 @@ module Temporal
|
|
|
189
189
|
# Keys here override client-level RPC metadata keys.
|
|
190
190
|
# @param rpc_timeout [Integer] Optional RPC deadline to set for each RPC call.
|
|
191
191
|
#
|
|
192
|
-
# @return [
|
|
192
|
+
# @return [Temporalio::Error::RPCError] Workflow could not be signalled.
|
|
193
193
|
def signal(signal, *args, rpc_metadata: {}, rpc_timeout: nil)
|
|
194
194
|
input = Interceptor::Client::SignalWorkflowInput.new(
|
|
195
195
|
id: id,
|
|
@@ -208,9 +208,9 @@ module Temporal
|
|
|
208
208
|
#
|
|
209
209
|
# This will issue a termination for {#run_id} if present. This call will make sure to use the
|
|
210
210
|
# run chain starting from {#first_execution_run_id} if present. To create handles with these
|
|
211
|
-
# values, use {
|
|
211
|
+
# values, use {Temporalio::Client#workflow_handle}.
|
|
212
212
|
|
|
213
|
-
# @note Handles created as a result of {
|
|
213
|
+
# @note Handles created as a result of {Temporalio::Client#start_workflow} with a start signal
|
|
214
214
|
# will terminate the latest workflow with the same workflow ID even if it is unrelated to
|
|
215
215
|
# the started workflow.
|
|
216
216
|
#
|
|
@@ -220,7 +220,7 @@ module Temporal
|
|
|
220
220
|
# Keys here override client-level RPC metadata keys.
|
|
221
221
|
# @param rpc_timeout [Integer] Optional RPC deadline to set for each RPC call.
|
|
222
222
|
#
|
|
223
|
-
# @raise [
|
|
223
|
+
# @raise [Temporalio::Error::RPCError] Workflow could not be terminated.
|
|
224
224
|
def terminate(reason = nil, args = nil, rpc_metadata: {}, rpc_timeout: nil)
|
|
225
225
|
input = Interceptor::Client::TerminateWorkflowInput.new(
|
|
226
226
|
id: id,
|
|
@@ -1,33 +1,27 @@
|
|
|
1
1
|
require 'json'
|
|
2
2
|
require 'securerandom'
|
|
3
3
|
require 'socket'
|
|
4
|
-
require '
|
|
5
|
-
require '
|
|
6
|
-
require '
|
|
7
|
-
require '
|
|
8
|
-
require '
|
|
9
|
-
require '
|
|
10
|
-
require '
|
|
4
|
+
require 'temporalio/client/implementation'
|
|
5
|
+
require 'temporalio/client/workflow_handle'
|
|
6
|
+
require 'temporalio/data_converter'
|
|
7
|
+
require 'temporalio/errors'
|
|
8
|
+
require 'temporalio/failure_converter'
|
|
9
|
+
require 'temporalio/payload_converter'
|
|
10
|
+
require 'temporalio/workflow/id_reuse_policy'
|
|
11
11
|
|
|
12
|
-
module
|
|
12
|
+
module Temporalio
|
|
13
13
|
class Client
|
|
14
14
|
# @return [String] Namespace used for client calls.
|
|
15
15
|
attr_reader :namespace
|
|
16
16
|
|
|
17
17
|
# Create a Temporal client from a connection.
|
|
18
18
|
#
|
|
19
|
-
# @param connection [
|
|
19
|
+
# @param connection [Temporalio::Connection] A connection to the Temporal server.
|
|
20
20
|
# @param namespace [String] Namespace to use for client calls.
|
|
21
|
-
# @param interceptors [Array<
|
|
21
|
+
# @param interceptors [Array<Temporalio::Interceptor::Client>] List of interceptors for
|
|
22
22
|
# intercepting client calls. Executed in their original order.
|
|
23
|
-
# @param
|
|
24
|
-
#
|
|
25
|
-
# interface definition.
|
|
26
|
-
# @param payload_codecs [Array<Temporal::PayloadCodec::Base>] A list of payload codecs to
|
|
27
|
-
# transform payload protos. See {Temporal::PayloadCodec::Base} for the interface definition.
|
|
28
|
-
# @param failure_converter [Temporal::FailureConverter::Base] A custom failure converter for
|
|
29
|
-
# converting Exceptions to/from protos. See {Temporal::FailureConverter::Base} for the
|
|
30
|
-
# interface definition.
|
|
23
|
+
# @param data_converter [Temporalio::DataConverter] Data converter to use for all data conversions
|
|
24
|
+
# to/from payloads.
|
|
31
25
|
#
|
|
32
26
|
# @see https://docs.temporal.io/concepts/what-is-a-data-converter for more information on
|
|
33
27
|
# payload converters and codecs.
|
|
@@ -35,16 +29,9 @@ module Temporal
|
|
|
35
29
|
connection,
|
|
36
30
|
namespace,
|
|
37
31
|
interceptors: [],
|
|
38
|
-
|
|
39
|
-
payload_codecs: [],
|
|
40
|
-
failure_converter: Temporal::FailureConverter::DEFAULT
|
|
32
|
+
data_converter: Temporalio::DataConverter.new
|
|
41
33
|
)
|
|
42
34
|
@namespace = namespace
|
|
43
|
-
data_converter = DataConverter.new(
|
|
44
|
-
payload_converter: payload_converter,
|
|
45
|
-
payload_codecs: payload_codecs,
|
|
46
|
-
failure_converter: failure_converter,
|
|
47
|
-
)
|
|
48
35
|
@implementation = Client::Implementation.new(connection, namespace, data_converter, interceptors)
|
|
49
36
|
end
|
|
50
37
|
|
|
@@ -59,9 +46,9 @@ module Temporal
|
|
|
59
46
|
# @param run_timeout [Integer] Timeout of a single workflow run.
|
|
60
47
|
# @param task_timeout [Integer] Timeout of a single workflow task.
|
|
61
48
|
# @param id_reuse_policy [Symbol] How already-existing IDs are treated. Refer to
|
|
62
|
-
# {
|
|
63
|
-
# @param retry_policy [
|
|
64
|
-
# See {
|
|
49
|
+
# {Temporalio::Workflow::IDReusePolicy} for the list of allowed values.
|
|
50
|
+
# @param retry_policy [Temporalio::RetryPolicy] Retry policy for the workflow.
|
|
51
|
+
# See {Temporalio::RetryPolicy}.
|
|
65
52
|
# @param cron_schedule [String] See https://docs.temporal.io/docs/content/what-is-a-temporal-cron-job.
|
|
66
53
|
# @param memo [Hash<String, any>] Memo for the workflow.
|
|
67
54
|
# @param search_attributes [Hash<String, any>] Search attributes for the workflow.
|
|
@@ -73,9 +60,9 @@ module Temporal
|
|
|
73
60
|
# client-level RPC metadata keys.
|
|
74
61
|
# @param rpc_timeout [Integer] Optional RPC deadline to set for the RPC call.
|
|
75
62
|
#
|
|
76
|
-
# @return [
|
|
63
|
+
# @return [Temporalio::Client::WorkflowHandle] A workflow handle to the started/existing workflow.
|
|
77
64
|
#
|
|
78
|
-
# @raise [
|
|
65
|
+
# @raise [Temporalio::Error::RPCError] Workflow could not be started.
|
|
79
66
|
def start_workflow( # rubocop:disable Metrics/ParameterLists
|
|
80
67
|
workflow,
|
|
81
68
|
*args,
|
|
@@ -126,7 +113,7 @@ module Temporal
|
|
|
126
113
|
# in a chain. Workflows are chained when using continue-as-new, retries (as permitted by the
|
|
127
114
|
# retry policy) or cron executions.
|
|
128
115
|
#
|
|
129
|
-
# @return [
|
|
116
|
+
# @return [Temporalio::Client::WorkflowHandle] The workflow handle.
|
|
130
117
|
def workflow_handle(id, run_id: nil, first_execution_run_id: nil)
|
|
131
118
|
WorkflowHandle.new(
|
|
132
119
|
implementation,
|