@temporalio/core-bridge 1.8.6 → 1.9.0-rc.0
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.
- package/Cargo.lock +189 -152
- package/Cargo.toml +1 -0
- package/lib/index.d.ts +17 -44
- package/lib/index.js.map +1 -1
- package/package.json +3 -4
- package/releases/aarch64-apple-darwin/index.node +0 -0
- package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
- package/releases/x86_64-apple-darwin/index.node +0 -0
- package/releases/x86_64-pc-windows-msvc/index.node +0 -0
- package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
- package/sdk-core/.github/workflows/heavy.yml +4 -0
- package/sdk-core/.github/workflows/per-pr.yml +96 -0
- package/sdk-core/ARCHITECTURE.md +1 -1
- package/sdk-core/Cargo.toml +6 -0
- package/sdk-core/README.md +37 -21
- package/sdk-core/client/Cargo.toml +6 -3
- package/sdk-core/client/src/lib.rs +272 -138
- package/sdk-core/client/src/metrics.rs +68 -57
- package/sdk-core/client/src/raw.rs +191 -45
- package/sdk-core/client/src/retry.rs +20 -0
- package/sdk-core/client/src/worker_registry/mod.rs +264 -0
- package/sdk-core/client/src/workflow_handle/mod.rs +2 -1
- package/sdk-core/core/Cargo.toml +16 -18
- package/sdk-core/core/src/core_tests/child_workflows.rs +7 -7
- package/sdk-core/core/src/core_tests/mod.rs +1 -0
- package/sdk-core/core/src/core_tests/replay_flag.rs +29 -39
- package/sdk-core/core/src/core_tests/updates.rs +73 -0
- package/sdk-core/core/src/core_tests/workflow_tasks.rs +52 -1
- package/sdk-core/core/src/ephemeral_server/mod.rs +34 -11
- package/sdk-core/core/src/internal_flags.rs +7 -1
- package/sdk-core/core/src/lib.rs +19 -36
- package/sdk-core/core/src/protosext/mod.rs +11 -3
- package/sdk-core/core/src/protosext/protocol_messages.rs +102 -0
- package/sdk-core/core/src/replay/mod.rs +100 -48
- package/sdk-core/core/src/telemetry/log_export.rs +161 -28
- package/sdk-core/core/src/telemetry/metrics.rs +869 -248
- package/sdk-core/core/src/telemetry/mod.rs +135 -239
- package/sdk-core/core/src/telemetry/prometheus_server.rs +36 -31
- package/sdk-core/core/src/test_help/mod.rs +63 -4
- package/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +12 -2
- package/sdk-core/core/src/worker/activities.rs +276 -10
- package/sdk-core/core/src/worker/client/mocks.rs +18 -0
- package/sdk-core/core/src/worker/client.rs +16 -3
- package/sdk-core/core/src/worker/mod.rs +50 -19
- package/sdk-core/core/src/worker/slot_provider.rs +175 -0
- package/sdk-core/core/src/worker/workflow/driven_workflow.rs +27 -34
- package/sdk-core/core/src/worker/workflow/history_update.rs +4 -1
- package/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +36 -94
- package/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +34 -22
- package/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +50 -34
- package/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +106 -92
- package/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +22 -21
- package/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +386 -499
- package/sdk-core/core/src/worker/workflow/machines/mod.rs +12 -2
- package/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +33 -26
- package/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +198 -215
- package/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +66 -62
- package/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +88 -119
- package/sdk-core/core/src/worker/workflow/machines/transition_coverage.rs +3 -1
- package/sdk-core/core/src/worker/workflow/machines/update_state_machine.rs +411 -0
- package/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +26 -25
- package/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +302 -85
- package/sdk-core/core/src/worker/workflow/managed_run.rs +179 -132
- package/sdk-core/core/src/worker/workflow/mod.rs +121 -46
- package/sdk-core/core/src/worker/workflow/run_cache.rs +8 -12
- package/sdk-core/core/src/worker/workflow/workflow_stream.rs +45 -38
- package/sdk-core/core-api/Cargo.toml +7 -6
- package/sdk-core/core-api/src/lib.rs +4 -12
- package/sdk-core/core-api/src/telemetry/metrics.rs +334 -0
- package/sdk-core/core-api/src/telemetry.rs +53 -42
- package/sdk-core/core-api/src/worker.rs +7 -0
- package/sdk-core/{.buildkite/docker → docker}/docker-compose.yaml +1 -1
- package/sdk-core/etc/dynamic-config.yaml +11 -1
- package/sdk-core/fsm/rustfsm_procmacro/Cargo.toml +1 -1
- package/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +1 -3
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +2 -2
- package/sdk-core/sdk/Cargo.toml +1 -1
- package/sdk-core/sdk/src/lib.rs +85 -7
- package/sdk-core/sdk/src/workflow_context/options.rs +4 -0
- package/sdk-core/sdk/src/workflow_context.rs +43 -15
- package/sdk-core/sdk/src/workflow_future.rs +334 -204
- package/sdk-core/sdk-core-protos/Cargo.toml +2 -2
- package/sdk-core/sdk-core-protos/build.rs +14 -14
- package/sdk-core/sdk-core-protos/protos/api_upstream/.buildkite/Dockerfile +2 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/Makefile +99 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/api-linter.yaml +56 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/buf.gen.yaml +20 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/buf.lock +11 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/buf.yaml +18 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/google/api/annotations.proto +31 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/google/api/http.proto +379 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/google/protobuf/any.proto +162 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/google/protobuf/descriptor.proto +1212 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/google/protobuf/duration.proto +115 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/google/protobuf/empty.proto +51 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/google/protobuf/timestamp.proto +144 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/google/protobuf/wrappers.proto +123 -0
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/batch/v1/message.proto +3 -5
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/command/v1/message.proto +11 -13
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/common/v1/message.proto +2 -4
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/failed_cause.proto +2 -0
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/reset.proto +1 -1
- package/sdk-core/{protos/api_upstream/build/tools.go → sdk-core-protos/protos/api_upstream/temporal/api/export/v1/message.proto} +22 -6
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/filter/v1/message.proto +2 -4
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/history/v1/message.proto +21 -23
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/namespace/v1/message.proto +2 -4
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/operatorservice/v1/request_response.proto +2 -0
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/operatorservice/v1/service.proto +4 -0
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/replication/v1/message.proto +1 -3
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/schedule/v1/message.proto +36 -20
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/sdk/v1/task_complete_metadata.proto +13 -0
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/taskqueue/v1/message.proto +2 -4
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/update/v1/message.proto +1 -1
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/version/v1/message.proto +2 -3
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/workflow/v1/message.proto +18 -20
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/workflowservice/v1/request_response.proto +84 -32
- package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/workflowservice/v1/service.proto +205 -47
- package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +57 -0
- package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +27 -0
- package/sdk-core/sdk-core-protos/src/history_builder.rs +67 -2
- package/sdk-core/sdk-core-protos/src/lib.rs +75 -2
- package/sdk-core/sdk-core-protos/src/utilities.rs +14 -0
- package/sdk-core/test-utils/Cargo.toml +5 -1
- package/sdk-core/test-utils/src/canned_histories.rs +3 -57
- package/sdk-core/test-utils/src/interceptors.rs +46 -0
- package/sdk-core/test-utils/src/lib.rs +106 -38
- package/sdk-core/tests/integ_tests/metrics_tests.rs +110 -15
- package/sdk-core/tests/integ_tests/queries_tests.rs +174 -3
- package/sdk-core/tests/integ_tests/update_tests.rs +908 -0
- package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +44 -1
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +4 -4
- package/sdk-core/tests/integ_tests/workflow_tests/eager.rs +61 -0
- package/sdk-core/tests/integ_tests/workflow_tests/replay.rs +27 -2
- package/sdk-core/tests/integ_tests/workflow_tests.rs +1 -0
- package/sdk-core/tests/main.rs +2 -1
- package/sdk-core/tests/runner.rs +15 -2
- package/src/conversions.rs +75 -89
- package/src/helpers.rs +74 -0
- package/src/runtime.rs +17 -6
- package/src/worker.rs +14 -61
- package/ts/index.ts +21 -52
- package/sdk-core/.buildkite/docker/Dockerfile +0 -9
- package/sdk-core/.buildkite/docker/build.sh +0 -5
- package/sdk-core/.buildkite/docker/docker-compose-ci.yaml +0 -27
- package/sdk-core/.buildkite/pipeline.yml +0 -57
- package/sdk-core/.github/workflows/semgrep.yml +0 -25
- package/sdk-core/core/src/worker/workflow/bridge.rs +0 -35
- package/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +0 -215
- package/sdk-core/protos/api_upstream/.buildkite/Dockerfile +0 -2
- package/sdk-core/protos/api_upstream/Makefile +0 -80
- package/sdk-core/protos/api_upstream/api-linter.yaml +0 -40
- package/sdk-core/protos/api_upstream/buf.yaml +0 -9
- package/sdk-core/protos/api_upstream/build/go.mod +0 -7
- package/sdk-core/protos/api_upstream/build/go.sum +0 -5
- package/sdk-core/protos/api_upstream/go.mod +0 -6
- package/sdk-core/protos/testsrv_upstream/dependencies/gogoproto/gogo.proto +0 -141
- /package/sdk-core/{.buildkite/docker → docker}/docker-compose-telem.yaml +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/.buildkite/docker-compose.yml +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/.buildkite/pipeline.yml +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/.github/CODEOWNERS +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/.github/workflows/publish-docs.yml +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/.github/workflows/trigger-api-go-update.yml +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/LICENSE +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/README.md +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/batch_operation.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/command_type.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/common.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/event_type.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/namespace.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/query.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/schedule.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/task_queue.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/update.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/workflow.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/errordetails/v1/message.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/failure/v1/message.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/protocol/v1/message.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/query/v1/message.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/google/rpc/status.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/grpc/health/v1/health.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/activity_result/activity_result.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/activity_task/activity_task.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/child_workflow/child_workflow.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/common/common.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/core_interface.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/external_data/external_data.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/workflow_completion/workflow_completion.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/testsrv_upstream/Makefile +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/testsrv_upstream/api-linter.yaml +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/testsrv_upstream/buf.yaml +0 -0
- /package/sdk-core/{protos/api_upstream → sdk-core-protos/protos/testsrv_upstream}/dependencies/gogoproto/gogo.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/testsrv_upstream/temporal/api/testservice/v1/request_response.proto +0 -0
- /package/sdk-core/{protos → sdk-core-protos/protos}/testsrv_upstream/temporal/api/testservice/v1/service.proto +0 -0
|
@@ -6,14 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
#[macro_use]
|
|
8
8
|
extern crate tracing;
|
|
9
|
-
|
|
10
9
|
mod metrics;
|
|
11
10
|
mod raw;
|
|
12
11
|
mod retry;
|
|
12
|
+
mod worker_registry;
|
|
13
13
|
mod workflow_handle;
|
|
14
14
|
|
|
15
15
|
pub use crate::retry::{CallType, RetryClient, RETRYABLE_ERROR_CODES};
|
|
16
|
-
pub use metrics::ClientMetricProvider;
|
|
17
16
|
pub use raw::{HealthService, OperatorService, TestService, WorkflowService};
|
|
18
17
|
pub use temporal_sdk_core_protos::temporal::api::{
|
|
19
18
|
enums::v1::ArchivalState,
|
|
@@ -24,6 +23,7 @@ pub use temporal_sdk_core_protos::temporal::api::{
|
|
|
24
23
|
},
|
|
25
24
|
};
|
|
26
25
|
pub use tonic;
|
|
26
|
+
pub use worker_registry::{Slot, SlotManager, SlotProvider, WorkerKey};
|
|
27
27
|
pub use workflow_handle::{WorkflowExecutionInfo, WorkflowExecutionResult};
|
|
28
28
|
|
|
29
29
|
use crate::{
|
|
@@ -44,6 +44,7 @@ use std::{
|
|
|
44
44
|
sync::Arc,
|
|
45
45
|
time::{Duration, Instant},
|
|
46
46
|
};
|
|
47
|
+
use temporal_sdk_core_api::telemetry::metrics::TemporalMeter;
|
|
47
48
|
use temporal_sdk_core_protos::{
|
|
48
49
|
coresdk::{workflow_commands::QueryResult, IntoPayloadsExt},
|
|
49
50
|
grpc::health::v1::health_client::HealthClient,
|
|
@@ -56,6 +57,7 @@ use temporal_sdk_core_protos::{
|
|
|
56
57
|
replication::v1::ClusterReplicationConfig,
|
|
57
58
|
taskqueue::v1::TaskQueue,
|
|
58
59
|
testservice::v1::test_service_client::TestServiceClient,
|
|
60
|
+
update,
|
|
59
61
|
workflowservice::v1::{workflow_service_client::WorkflowServiceClient, *},
|
|
60
62
|
},
|
|
61
63
|
TaskToken,
|
|
@@ -76,7 +78,11 @@ use uuid::Uuid;
|
|
|
76
78
|
static CLIENT_NAME_HEADER_KEY: &str = "client-name";
|
|
77
79
|
static CLIENT_VERSION_HEADER_KEY: &str = "client-version";
|
|
78
80
|
/// These must match the gRPC method names, not the snake case versions that exist in the Rust code.
|
|
79
|
-
static LONG_POLL_METHOD_NAMES: [&str;
|
|
81
|
+
static LONG_POLL_METHOD_NAMES: [&str; 3] = [
|
|
82
|
+
"PollWorkflowTaskQueue",
|
|
83
|
+
"PollActivityTaskQueue",
|
|
84
|
+
"PollWorkflowExecutionUpdateRequest",
|
|
85
|
+
];
|
|
80
86
|
/// The server times out polls after 60 seconds. Set our timeout to be slightly beyond that.
|
|
81
87
|
const LONG_POLL_TIMEOUT: Duration = Duration::from_secs(70);
|
|
82
88
|
const OTHER_CALL_TIMEOUT: Duration = Duration::from_secs(30);
|
|
@@ -122,6 +128,10 @@ pub struct ClientOptions {
|
|
|
122
128
|
/// override.
|
|
123
129
|
#[builder(default)]
|
|
124
130
|
pub override_origin: Option<Uri>,
|
|
131
|
+
|
|
132
|
+
/// If set (which it is by default), HTTP2 gRPC keep alive will be enabled.
|
|
133
|
+
#[builder(default = "Some(ClientKeepAliveConfig::default())")]
|
|
134
|
+
pub keep_alive: Option<ClientKeepAliveConfig>,
|
|
125
135
|
}
|
|
126
136
|
|
|
127
137
|
/// Configuration options for TLS
|
|
@@ -147,6 +157,24 @@ pub struct ClientTlsConfig {
|
|
|
147
157
|
pub client_private_key: Vec<u8>,
|
|
148
158
|
}
|
|
149
159
|
|
|
160
|
+
/// Client keep alive configuration.
|
|
161
|
+
#[derive(Clone, Debug)]
|
|
162
|
+
pub struct ClientKeepAliveConfig {
|
|
163
|
+
/// Interval to send HTTP2 keep alive pings.
|
|
164
|
+
pub interval: Duration,
|
|
165
|
+
/// Timeout that the keep alive must be responded to within or the connection will be closed.
|
|
166
|
+
pub timeout: Duration,
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
impl Default for ClientKeepAliveConfig {
|
|
170
|
+
fn default() -> Self {
|
|
171
|
+
Self {
|
|
172
|
+
interval: Duration::from_secs(30),
|
|
173
|
+
timeout: Duration::from_secs(15),
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
150
178
|
/// Configuration for retrying requests to the server
|
|
151
179
|
#[derive(Clone, Debug)]
|
|
152
180
|
pub struct RetryConfig {
|
|
@@ -253,6 +281,7 @@ pub struct ConfiguredClient<C> {
|
|
|
253
281
|
headers: Arc<RwLock<HashMap<String, String>>>,
|
|
254
282
|
/// Capabilities as read from the `get_system_info` RPC call made on client connection
|
|
255
283
|
capabilities: Option<get_system_info_response::Capabilities>,
|
|
284
|
+
workers: Arc<SlotManager>,
|
|
256
285
|
}
|
|
257
286
|
|
|
258
287
|
impl<C> ConfiguredClient<C> {
|
|
@@ -272,6 +301,11 @@ impl<C> ConfiguredClient<C> {
|
|
|
272
301
|
pub fn capabilities(&self) -> Option<&get_system_info_response::Capabilities> {
|
|
273
302
|
self.capabilities.as_ref()
|
|
274
303
|
}
|
|
304
|
+
|
|
305
|
+
/// Returns a cloned reference to a registry with workers using this client instance
|
|
306
|
+
pub fn workers(&self) -> Arc<SlotManager> {
|
|
307
|
+
self.workers.clone()
|
|
308
|
+
}
|
|
275
309
|
}
|
|
276
310
|
|
|
277
311
|
// The configured client is effectively a "smart" (dumb) pointer
|
|
@@ -294,7 +328,7 @@ impl ClientOptions {
|
|
|
294
328
|
pub async fn connect(
|
|
295
329
|
&self,
|
|
296
330
|
namespace: impl Into<String>,
|
|
297
|
-
metrics_meter: Option
|
|
331
|
+
metrics_meter: Option<TemporalMeter>,
|
|
298
332
|
headers: Option<Arc<RwLock<HashMap<String, String>>>>,
|
|
299
333
|
) -> Result<RetryClient<Client>, ClientInitError> {
|
|
300
334
|
let client = self
|
|
@@ -312,12 +346,20 @@ impl ClientOptions {
|
|
|
312
346
|
/// See [RetryClient] for more
|
|
313
347
|
pub async fn connect_no_namespace(
|
|
314
348
|
&self,
|
|
315
|
-
metrics_meter: Option
|
|
349
|
+
metrics_meter: Option<TemporalMeter>,
|
|
316
350
|
headers: Option<Arc<RwLock<HashMap<String, String>>>>,
|
|
317
351
|
) -> Result<RetryClient<ConfiguredClient<TemporalServiceClientWithMetrics>>, ClientInitError>
|
|
318
352
|
{
|
|
319
353
|
let channel = Channel::from_shared(self.target_url.to_string())?;
|
|
320
354
|
let channel = self.add_tls_to_channel(channel).await?;
|
|
355
|
+
let channel = if let Some(keep_alive) = self.keep_alive.as_ref() {
|
|
356
|
+
channel
|
|
357
|
+
.keep_alive_while_idle(true)
|
|
358
|
+
.http2_keep_alive_interval(keep_alive.interval)
|
|
359
|
+
.keep_alive_timeout(keep_alive.timeout)
|
|
360
|
+
} else {
|
|
361
|
+
channel
|
|
362
|
+
};
|
|
321
363
|
let channel = if let Some(origin) = self.override_origin.clone() {
|
|
322
364
|
channel.origin(origin)
|
|
323
365
|
} else {
|
|
@@ -325,9 +367,9 @@ impl ClientOptions {
|
|
|
325
367
|
};
|
|
326
368
|
let channel = channel.connect().await?;
|
|
327
369
|
let service = ServiceBuilder::new()
|
|
328
|
-
.layer_fn(|channel| GrpcMetricSvc {
|
|
370
|
+
.layer_fn(move |channel| GrpcMetricSvc {
|
|
329
371
|
inner: channel,
|
|
330
|
-
metrics: metrics_meter.map(
|
|
372
|
+
metrics: metrics_meter.clone().map(MetricsContext::new),
|
|
331
373
|
})
|
|
332
374
|
.service(channel);
|
|
333
375
|
let headers = headers.unwrap_or_default();
|
|
@@ -342,6 +384,7 @@ impl ClientOptions {
|
|
|
342
384
|
client: TemporalServiceClient::new(svc),
|
|
343
385
|
options: Arc::new(self.clone()),
|
|
344
386
|
capabilities: None,
|
|
387
|
+
workers: Arc::new(SlotManager::new()),
|
|
345
388
|
};
|
|
346
389
|
match client
|
|
347
390
|
.get_system_info(GetSystemInfoRequest::default())
|
|
@@ -578,10 +621,6 @@ impl Client {
|
|
|
578
621
|
pub fn into_inner(self) -> ConfiguredClient<TemporalServiceClientWithMetrics> {
|
|
579
622
|
self.inner
|
|
580
623
|
}
|
|
581
|
-
|
|
582
|
-
fn wf_svc(&self) -> WorkflowServiceClientWithMetrics {
|
|
583
|
-
self.inner.workflow_svc().clone()
|
|
584
|
-
}
|
|
585
624
|
}
|
|
586
625
|
|
|
587
626
|
/// Enum to help reference a namespace by either the namespace name or the namespace id
|
|
@@ -905,6 +944,16 @@ pub trait WorkflowClientTrait {
|
|
|
905
944
|
/// Get Cluster Search Attributes
|
|
906
945
|
async fn get_search_attributes(&self) -> Result<GetSearchAttributesResponse>;
|
|
907
946
|
|
|
947
|
+
/// Send an Update to a workflow execution
|
|
948
|
+
async fn update_workflow_execution(
|
|
949
|
+
&self,
|
|
950
|
+
workflow_id: String,
|
|
951
|
+
run_id: String,
|
|
952
|
+
name: String,
|
|
953
|
+
wait_policy: update::v1::WaitPolicy,
|
|
954
|
+
args: Option<Payloads>,
|
|
955
|
+
) -> Result<UpdateWorkflowExecutionResponse>;
|
|
956
|
+
|
|
908
957
|
/// Returns options that were used to initialize the client
|
|
909
958
|
fn get_options(&self) -> &ClientOptions;
|
|
910
959
|
|
|
@@ -933,6 +982,10 @@ pub struct WorkflowOptions {
|
|
|
933
982
|
|
|
934
983
|
/// Optionally associate extra search attributes with a workflow
|
|
935
984
|
pub search_attributes: Option<HashMap<String, Payload>>,
|
|
985
|
+
|
|
986
|
+
/// Optionally enable Eager Workflow Start, a latency optimization using local workers
|
|
987
|
+
/// NOTE: Experimental and incompatible with versioning with BuildIDs
|
|
988
|
+
pub enable_eager_workflow_start: bool,
|
|
936
989
|
}
|
|
937
990
|
|
|
938
991
|
#[async_trait::async_trait]
|
|
@@ -946,9 +999,9 @@ impl WorkflowClientTrait for Client {
|
|
|
946
999
|
request_id: Option<String>,
|
|
947
1000
|
options: WorkflowOptions,
|
|
948
1001
|
) -> Result<StartWorkflowExecutionResponse> {
|
|
949
|
-
Ok(
|
|
950
|
-
.
|
|
951
|
-
|
|
1002
|
+
Ok(WorkflowService::start_workflow_execution(
|
|
1003
|
+
&mut self.inner.clone(),
|
|
1004
|
+
StartWorkflowExecutionRequest {
|
|
952
1005
|
namespace: self.namespace.clone(),
|
|
953
1006
|
input: input.into_payloads(),
|
|
954
1007
|
workflow_id,
|
|
@@ -965,14 +1018,16 @@ impl WorkflowClientTrait for Client {
|
|
|
965
1018
|
workflow_execution_timeout: options
|
|
966
1019
|
.execution_timeout
|
|
967
1020
|
.and_then(|d| d.try_into().ok()),
|
|
968
|
-
workflow_run_timeout: options.
|
|
1021
|
+
workflow_run_timeout: options.run_timeout.and_then(|d| d.try_into().ok()),
|
|
969
1022
|
workflow_task_timeout: options.task_timeout.and_then(|d| d.try_into().ok()),
|
|
970
1023
|
search_attributes: options.search_attributes.and_then(|d| d.try_into().ok()),
|
|
971
1024
|
cron_schedule: options.cron_schedule.unwrap_or_default(),
|
|
1025
|
+
request_eager_execution: options.enable_eager_workflow_start,
|
|
972
1026
|
..Default::default()
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
|
|
1027
|
+
},
|
|
1028
|
+
)
|
|
1029
|
+
.await?
|
|
1030
|
+
.into_inner())
|
|
976
1031
|
}
|
|
977
1032
|
|
|
978
1033
|
async fn reset_sticky_task_queue(
|
|
@@ -987,11 +1042,11 @@ impl WorkflowClientTrait for Client {
|
|
|
987
1042
|
run_id,
|
|
988
1043
|
}),
|
|
989
1044
|
};
|
|
990
|
-
Ok(
|
|
991
|
-
.
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
1045
|
+
Ok(
|
|
1046
|
+
WorkflowService::reset_sticky_task_queue(&mut self.inner.client.clone(), request)
|
|
1047
|
+
.await?
|
|
1048
|
+
.into_inner(),
|
|
1049
|
+
)
|
|
995
1050
|
}
|
|
996
1051
|
|
|
997
1052
|
async fn complete_activity_task(
|
|
@@ -999,17 +1054,18 @@ impl WorkflowClientTrait for Client {
|
|
|
999
1054
|
task_token: TaskToken,
|
|
1000
1055
|
result: Option<Payloads>,
|
|
1001
1056
|
) -> Result<RespondActivityTaskCompletedResponse> {
|
|
1002
|
-
Ok(
|
|
1003
|
-
.
|
|
1004
|
-
|
|
1057
|
+
Ok(WorkflowService::respond_activity_task_completed(
|
|
1058
|
+
&mut self.inner.client.clone(),
|
|
1059
|
+
RespondActivityTaskCompletedRequest {
|
|
1005
1060
|
task_token: task_token.0,
|
|
1006
1061
|
result,
|
|
1007
1062
|
identity: self.inner.options.identity.clone(),
|
|
1008
1063
|
namespace: self.namespace.clone(),
|
|
1009
1064
|
worker_version: None,
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
|
|
1065
|
+
},
|
|
1066
|
+
)
|
|
1067
|
+
.await?
|
|
1068
|
+
.into_inner())
|
|
1013
1069
|
}
|
|
1014
1070
|
|
|
1015
1071
|
async fn record_activity_heartbeat(
|
|
@@ -1017,16 +1073,17 @@ impl WorkflowClientTrait for Client {
|
|
|
1017
1073
|
task_token: TaskToken,
|
|
1018
1074
|
details: Option<Payloads>,
|
|
1019
1075
|
) -> Result<RecordActivityTaskHeartbeatResponse> {
|
|
1020
|
-
Ok(
|
|
1021
|
-
.
|
|
1022
|
-
|
|
1076
|
+
Ok(WorkflowService::record_activity_task_heartbeat(
|
|
1077
|
+
&mut self.inner.client.clone(),
|
|
1078
|
+
RecordActivityTaskHeartbeatRequest {
|
|
1023
1079
|
task_token: task_token.0,
|
|
1024
1080
|
details,
|
|
1025
1081
|
identity: self.inner.options.identity.clone(),
|
|
1026
1082
|
namespace: self.namespace.clone(),
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
|
|
1083
|
+
},
|
|
1084
|
+
)
|
|
1085
|
+
.await?
|
|
1086
|
+
.into_inner())
|
|
1030
1087
|
}
|
|
1031
1088
|
|
|
1032
1089
|
async fn cancel_activity_task(
|
|
@@ -1034,17 +1091,18 @@ impl WorkflowClientTrait for Client {
|
|
|
1034
1091
|
task_token: TaskToken,
|
|
1035
1092
|
details: Option<Payloads>,
|
|
1036
1093
|
) -> Result<RespondActivityTaskCanceledResponse> {
|
|
1037
|
-
Ok(
|
|
1038
|
-
.
|
|
1039
|
-
|
|
1094
|
+
Ok(WorkflowService::respond_activity_task_canceled(
|
|
1095
|
+
&mut self.inner.client.clone(),
|
|
1096
|
+
RespondActivityTaskCanceledRequest {
|
|
1040
1097
|
task_token: task_token.0,
|
|
1041
1098
|
details,
|
|
1042
1099
|
identity: self.inner.options.identity.clone(),
|
|
1043
1100
|
namespace: self.namespace.clone(),
|
|
1044
1101
|
worker_version: None,
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
|
|
1102
|
+
},
|
|
1103
|
+
)
|
|
1104
|
+
.await?
|
|
1105
|
+
.into_inner())
|
|
1048
1106
|
}
|
|
1049
1107
|
|
|
1050
1108
|
async fn fail_activity_task(
|
|
@@ -1052,9 +1110,9 @@ impl WorkflowClientTrait for Client {
|
|
|
1052
1110
|
task_token: TaskToken,
|
|
1053
1111
|
failure: Option<Failure>,
|
|
1054
1112
|
) -> Result<RespondActivityTaskFailedResponse> {
|
|
1055
|
-
Ok(
|
|
1056
|
-
.
|
|
1057
|
-
|
|
1113
|
+
Ok(WorkflowService::respond_activity_task_failed(
|
|
1114
|
+
&mut self.inner.client.clone(),
|
|
1115
|
+
RespondActivityTaskFailedRequest {
|
|
1058
1116
|
task_token: task_token.0,
|
|
1059
1117
|
failure,
|
|
1060
1118
|
identity: self.inner.options.identity.clone(),
|
|
@@ -1062,9 +1120,10 @@ impl WorkflowClientTrait for Client {
|
|
|
1062
1120
|
// TODO: Implement - https://github.com/temporalio/sdk-core/issues/293
|
|
1063
1121
|
last_heartbeat_details: None,
|
|
1064
1122
|
worker_version: None,
|
|
1065
|
-
}
|
|
1066
|
-
|
|
1067
|
-
|
|
1123
|
+
},
|
|
1124
|
+
)
|
|
1125
|
+
.await?
|
|
1126
|
+
.into_inner())
|
|
1068
1127
|
}
|
|
1069
1128
|
|
|
1070
1129
|
async fn signal_workflow_execution(
|
|
@@ -1075,9 +1134,9 @@ impl WorkflowClientTrait for Client {
|
|
|
1075
1134
|
payloads: Option<Payloads>,
|
|
1076
1135
|
request_id: Option<String>,
|
|
1077
1136
|
) -> Result<SignalWorkflowExecutionResponse> {
|
|
1078
|
-
Ok(
|
|
1079
|
-
.
|
|
1080
|
-
|
|
1137
|
+
Ok(WorkflowService::signal_workflow_execution(
|
|
1138
|
+
&mut self.inner.client.clone(),
|
|
1139
|
+
SignalWorkflowExecutionRequest {
|
|
1081
1140
|
namespace: self.namespace.clone(),
|
|
1082
1141
|
workflow_execution: Some(WorkflowExecution {
|
|
1083
1142
|
workflow_id,
|
|
@@ -1088,9 +1147,10 @@ impl WorkflowClientTrait for Client {
|
|
|
1088
1147
|
identity: self.inner.options.identity.clone(),
|
|
1089
1148
|
request_id: request_id.unwrap_or_else(|| Uuid::new_v4().to_string()),
|
|
1090
1149
|
..Default::default()
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
|
|
1150
|
+
},
|
|
1151
|
+
)
|
|
1152
|
+
.await?
|
|
1153
|
+
.into_inner())
|
|
1094
1154
|
}
|
|
1095
1155
|
|
|
1096
1156
|
async fn signal_with_start_workflow_execution(
|
|
@@ -1098,9 +1158,9 @@ impl WorkflowClientTrait for Client {
|
|
|
1098
1158
|
options: SignalWithStartOptions,
|
|
1099
1159
|
workflow_options: WorkflowOptions,
|
|
1100
1160
|
) -> Result<SignalWithStartWorkflowExecutionResponse> {
|
|
1101
|
-
Ok(
|
|
1102
|
-
.
|
|
1103
|
-
|
|
1161
|
+
Ok(WorkflowService::signal_with_start_workflow_execution(
|
|
1162
|
+
&mut self.inner.client.clone(),
|
|
1163
|
+
SignalWithStartWorkflowExecutionRequest {
|
|
1104
1164
|
namespace: self.namespace.clone(),
|
|
1105
1165
|
workflow_id: options.workflow_id,
|
|
1106
1166
|
workflow_type: Some(WorkflowType {
|
|
@@ -1122,9 +1182,7 @@ impl WorkflowClientTrait for Client {
|
|
|
1122
1182
|
workflow_execution_timeout: workflow_options
|
|
1123
1183
|
.execution_timeout
|
|
1124
1184
|
.and_then(|d| d.try_into().ok()),
|
|
1125
|
-
workflow_run_timeout: workflow_options
|
|
1126
|
-
.execution_timeout
|
|
1127
|
-
.and_then(|d| d.try_into().ok()),
|
|
1185
|
+
workflow_run_timeout: workflow_options.run_timeout.and_then(|d| d.try_into().ok()),
|
|
1128
1186
|
workflow_task_timeout: workflow_options
|
|
1129
1187
|
.task_timeout
|
|
1130
1188
|
.and_then(|d| d.try_into().ok()),
|
|
@@ -1134,9 +1192,10 @@ impl WorkflowClientTrait for Client {
|
|
|
1134
1192
|
cron_schedule: workflow_options.cron_schedule.unwrap_or_default(),
|
|
1135
1193
|
header: options.signal_header,
|
|
1136
1194
|
..Default::default()
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
|
|
1195
|
+
},
|
|
1196
|
+
)
|
|
1197
|
+
.await?
|
|
1198
|
+
.into_inner())
|
|
1140
1199
|
}
|
|
1141
1200
|
|
|
1142
1201
|
async fn query_workflow_execution(
|
|
@@ -1145,9 +1204,9 @@ impl WorkflowClientTrait for Client {
|
|
|
1145
1204
|
run_id: String,
|
|
1146
1205
|
query: WorkflowQuery,
|
|
1147
1206
|
) -> Result<QueryWorkflowResponse> {
|
|
1148
|
-
Ok(
|
|
1149
|
-
.
|
|
1150
|
-
|
|
1207
|
+
Ok(WorkflowService::query_workflow(
|
|
1208
|
+
&mut self.inner.client.clone(),
|
|
1209
|
+
QueryWorkflowRequest {
|
|
1151
1210
|
namespace: self.namespace.clone(),
|
|
1152
1211
|
execution: Some(WorkflowExecution {
|
|
1153
1212
|
workflow_id,
|
|
@@ -1155,9 +1214,10 @@ impl WorkflowClientTrait for Client {
|
|
|
1155
1214
|
}),
|
|
1156
1215
|
query: Some(query),
|
|
1157
1216
|
query_reject_condition: 1,
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
|
-
|
|
1217
|
+
},
|
|
1218
|
+
)
|
|
1219
|
+
.await?
|
|
1220
|
+
.into_inner())
|
|
1161
1221
|
}
|
|
1162
1222
|
|
|
1163
1223
|
async fn describe_workflow_execution(
|
|
@@ -1165,17 +1225,18 @@ impl WorkflowClientTrait for Client {
|
|
|
1165
1225
|
workflow_id: String,
|
|
1166
1226
|
run_id: Option<String>,
|
|
1167
1227
|
) -> Result<DescribeWorkflowExecutionResponse> {
|
|
1168
|
-
Ok(
|
|
1169
|
-
.
|
|
1170
|
-
|
|
1228
|
+
Ok(WorkflowService::describe_workflow_execution(
|
|
1229
|
+
&mut self.inner.client.clone(),
|
|
1230
|
+
DescribeWorkflowExecutionRequest {
|
|
1171
1231
|
namespace: self.namespace.clone(),
|
|
1172
1232
|
execution: Some(WorkflowExecution {
|
|
1173
1233
|
workflow_id,
|
|
1174
1234
|
run_id: run_id.unwrap_or_default(),
|
|
1175
1235
|
}),
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
|
|
1236
|
+
},
|
|
1237
|
+
)
|
|
1238
|
+
.await?
|
|
1239
|
+
.into_inner())
|
|
1179
1240
|
}
|
|
1180
1241
|
|
|
1181
1242
|
async fn get_workflow_execution_history(
|
|
@@ -1184,9 +1245,9 @@ impl WorkflowClientTrait for Client {
|
|
|
1184
1245
|
run_id: Option<String>,
|
|
1185
1246
|
page_token: Vec<u8>,
|
|
1186
1247
|
) -> Result<GetWorkflowExecutionHistoryResponse> {
|
|
1187
|
-
Ok(
|
|
1188
|
-
.
|
|
1189
|
-
|
|
1248
|
+
Ok(WorkflowService::get_workflow_execution_history(
|
|
1249
|
+
&mut self.inner.client.clone(),
|
|
1250
|
+
GetWorkflowExecutionHistoryRequest {
|
|
1190
1251
|
namespace: self.namespace.clone(),
|
|
1191
1252
|
execution: Some(WorkflowExecution {
|
|
1192
1253
|
workflow_id,
|
|
@@ -1194,9 +1255,10 @@ impl WorkflowClientTrait for Client {
|
|
|
1194
1255
|
}),
|
|
1195
1256
|
next_page_token: page_token,
|
|
1196
1257
|
..Default::default()
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1199
|
-
|
|
1258
|
+
},
|
|
1259
|
+
)
|
|
1260
|
+
.await?
|
|
1261
|
+
.into_inner())
|
|
1200
1262
|
}
|
|
1201
1263
|
|
|
1202
1264
|
async fn respond_legacy_query(
|
|
@@ -1205,17 +1267,18 @@ impl WorkflowClientTrait for Client {
|
|
|
1205
1267
|
query_result: QueryResult,
|
|
1206
1268
|
) -> Result<RespondQueryTaskCompletedResponse> {
|
|
1207
1269
|
let (_, completed_type, query_result, error_message) = query_result.into_components();
|
|
1208
|
-
Ok(
|
|
1209
|
-
.
|
|
1210
|
-
|
|
1270
|
+
Ok(WorkflowService::respond_query_task_completed(
|
|
1271
|
+
&mut self.inner.client.clone(),
|
|
1272
|
+
RespondQueryTaskCompletedRequest {
|
|
1211
1273
|
task_token: task_token.into(),
|
|
1212
1274
|
completed_type: completed_type as i32,
|
|
1213
1275
|
query_result,
|
|
1214
1276
|
error_message,
|
|
1215
1277
|
namespace: self.namespace.clone(),
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
|
|
1278
|
+
},
|
|
1279
|
+
)
|
|
1280
|
+
.await?
|
|
1281
|
+
.into_inner())
|
|
1219
1282
|
}
|
|
1220
1283
|
|
|
1221
1284
|
async fn cancel_workflow_execution(
|
|
@@ -1225,9 +1288,9 @@ impl WorkflowClientTrait for Client {
|
|
|
1225
1288
|
reason: String,
|
|
1226
1289
|
request_id: Option<String>,
|
|
1227
1290
|
) -> Result<RequestCancelWorkflowExecutionResponse> {
|
|
1228
|
-
Ok(
|
|
1229
|
-
.
|
|
1230
|
-
|
|
1291
|
+
Ok(WorkflowService::request_cancel_workflow_execution(
|
|
1292
|
+
&mut self.inner.client.clone(),
|
|
1293
|
+
RequestCancelWorkflowExecutionRequest {
|
|
1231
1294
|
namespace: self.namespace.clone(),
|
|
1232
1295
|
workflow_execution: Some(WorkflowExecution {
|
|
1233
1296
|
workflow_id,
|
|
@@ -1237,9 +1300,10 @@ impl WorkflowClientTrait for Client {
|
|
|
1237
1300
|
request_id: request_id.unwrap_or_else(|| Uuid::new_v4().to_string()),
|
|
1238
1301
|
first_execution_run_id: "".to_string(),
|
|
1239
1302
|
reason,
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
|
|
1303
|
+
},
|
|
1304
|
+
)
|
|
1305
|
+
.await?
|
|
1306
|
+
.into_inner())
|
|
1243
1307
|
}
|
|
1244
1308
|
|
|
1245
1309
|
async fn terminate_workflow_execution(
|
|
@@ -1247,9 +1311,9 @@ impl WorkflowClientTrait for Client {
|
|
|
1247
1311
|
workflow_id: String,
|
|
1248
1312
|
run_id: Option<String>,
|
|
1249
1313
|
) -> Result<TerminateWorkflowExecutionResponse> {
|
|
1250
|
-
Ok(
|
|
1251
|
-
.
|
|
1252
|
-
|
|
1314
|
+
Ok(WorkflowService::terminate_workflow_execution(
|
|
1315
|
+
&mut self.inner.client.clone(),
|
|
1316
|
+
TerminateWorkflowExecutionRequest {
|
|
1253
1317
|
namespace: self.namespace.clone(),
|
|
1254
1318
|
workflow_execution: Some(WorkflowExecution {
|
|
1255
1319
|
workflow_id,
|
|
@@ -1259,9 +1323,10 @@ impl WorkflowClientTrait for Client {
|
|
|
1259
1323
|
details: None,
|
|
1260
1324
|
identity: self.inner.options.identity.clone(),
|
|
1261
1325
|
first_execution_run_id: "".to_string(),
|
|
1262
|
-
}
|
|
1263
|
-
|
|
1264
|
-
|
|
1326
|
+
},
|
|
1327
|
+
)
|
|
1328
|
+
.await?
|
|
1329
|
+
.into_inner())
|
|
1265
1330
|
}
|
|
1266
1331
|
|
|
1267
1332
|
async fn register_namespace(
|
|
@@ -1269,23 +1334,29 @@ impl WorkflowClientTrait for Client {
|
|
|
1269
1334
|
options: RegisterNamespaceOptions,
|
|
1270
1335
|
) -> Result<RegisterNamespaceResponse> {
|
|
1271
1336
|
let req = Into::<RegisterNamespaceRequest>::into(options);
|
|
1272
|
-
Ok(
|
|
1337
|
+
Ok(
|
|
1338
|
+
WorkflowService::register_namespace(&mut self.inner.client.clone(), req)
|
|
1339
|
+
.await?
|
|
1340
|
+
.into_inner(),
|
|
1341
|
+
)
|
|
1273
1342
|
}
|
|
1274
1343
|
|
|
1275
1344
|
async fn list_namespaces(&self) -> Result<ListNamespacesResponse> {
|
|
1276
|
-
Ok(
|
|
1277
|
-
.
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1345
|
+
Ok(WorkflowService::list_namespaces(
|
|
1346
|
+
&mut self.inner.client.clone(),
|
|
1347
|
+
ListNamespacesRequest::default(),
|
|
1348
|
+
)
|
|
1349
|
+
.await?
|
|
1350
|
+
.into_inner())
|
|
1281
1351
|
}
|
|
1282
1352
|
|
|
1283
1353
|
async fn describe_namespace(&self, namespace: Namespace) -> Result<DescribeNamespaceResponse> {
|
|
1284
|
-
Ok(
|
|
1285
|
-
.
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1354
|
+
Ok(WorkflowService::describe_namespace(
|
|
1355
|
+
&mut self.inner.client.clone(),
|
|
1356
|
+
namespace.into_describe_namespace_request(),
|
|
1357
|
+
)
|
|
1358
|
+
.await?
|
|
1359
|
+
.into_inner())
|
|
1289
1360
|
}
|
|
1290
1361
|
|
|
1291
1362
|
async fn list_open_workflow_executions(
|
|
@@ -1295,17 +1366,18 @@ impl WorkflowClientTrait for Client {
|
|
|
1295
1366
|
start_time_filter: Option<StartTimeFilter>,
|
|
1296
1367
|
filters: Option<ListOpenFilters>,
|
|
1297
1368
|
) -> Result<ListOpenWorkflowExecutionsResponse> {
|
|
1298
|
-
Ok(
|
|
1299
|
-
.
|
|
1300
|
-
|
|
1369
|
+
Ok(WorkflowService::list_open_workflow_executions(
|
|
1370
|
+
&mut self.inner.client.clone(),
|
|
1371
|
+
ListOpenWorkflowExecutionsRequest {
|
|
1301
1372
|
namespace: self.namespace.clone(),
|
|
1302
1373
|
maximum_page_size,
|
|
1303
1374
|
next_page_token,
|
|
1304
1375
|
start_time_filter,
|
|
1305
1376
|
filters,
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
|
-
|
|
1377
|
+
},
|
|
1378
|
+
)
|
|
1379
|
+
.await?
|
|
1380
|
+
.into_inner())
|
|
1309
1381
|
}
|
|
1310
1382
|
|
|
1311
1383
|
async fn list_closed_workflow_executions(
|
|
@@ -1315,17 +1387,18 @@ impl WorkflowClientTrait for Client {
|
|
|
1315
1387
|
start_time_filter: Option<StartTimeFilter>,
|
|
1316
1388
|
filters: Option<ListClosedFilters>,
|
|
1317
1389
|
) -> Result<ListClosedWorkflowExecutionsResponse> {
|
|
1318
|
-
Ok(
|
|
1319
|
-
.
|
|
1320
|
-
|
|
1390
|
+
Ok(WorkflowService::list_closed_workflow_executions(
|
|
1391
|
+
&mut self.inner.client.clone(),
|
|
1392
|
+
ListClosedWorkflowExecutionsRequest {
|
|
1321
1393
|
namespace: self.namespace.clone(),
|
|
1322
1394
|
maximum_page_size,
|
|
1323
1395
|
next_page_token,
|
|
1324
1396
|
start_time_filter,
|
|
1325
1397
|
filters,
|
|
1326
|
-
}
|
|
1327
|
-
|
|
1328
|
-
|
|
1398
|
+
},
|
|
1399
|
+
)
|
|
1400
|
+
.await?
|
|
1401
|
+
.into_inner())
|
|
1329
1402
|
}
|
|
1330
1403
|
|
|
1331
1404
|
async fn list_workflow_executions(
|
|
@@ -1334,16 +1407,17 @@ impl WorkflowClientTrait for Client {
|
|
|
1334
1407
|
next_page_token: Vec<u8>,
|
|
1335
1408
|
query: String,
|
|
1336
1409
|
) -> Result<ListWorkflowExecutionsResponse> {
|
|
1337
|
-
Ok(
|
|
1338
|
-
.
|
|
1339
|
-
|
|
1410
|
+
Ok(WorkflowService::list_workflow_executions(
|
|
1411
|
+
&mut self.inner.client.clone(),
|
|
1412
|
+
ListWorkflowExecutionsRequest {
|
|
1340
1413
|
namespace: self.namespace.clone(),
|
|
1341
1414
|
page_size,
|
|
1342
1415
|
next_page_token,
|
|
1343
1416
|
query,
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
|
|
1417
|
+
},
|
|
1418
|
+
)
|
|
1419
|
+
.await?
|
|
1420
|
+
.into_inner())
|
|
1347
1421
|
}
|
|
1348
1422
|
|
|
1349
1423
|
async fn list_archived_workflow_executions(
|
|
@@ -1352,24 +1426,61 @@ impl WorkflowClientTrait for Client {
|
|
|
1352
1426
|
next_page_token: Vec<u8>,
|
|
1353
1427
|
query: String,
|
|
1354
1428
|
) -> Result<ListArchivedWorkflowExecutionsResponse> {
|
|
1355
|
-
Ok(
|
|
1356
|
-
.
|
|
1357
|
-
|
|
1429
|
+
Ok(WorkflowService::list_archived_workflow_executions(
|
|
1430
|
+
&mut self.inner.client.clone(),
|
|
1431
|
+
ListArchivedWorkflowExecutionsRequest {
|
|
1358
1432
|
namespace: self.namespace.clone(),
|
|
1359
1433
|
page_size,
|
|
1360
1434
|
next_page_token,
|
|
1361
1435
|
query,
|
|
1362
|
-
}
|
|
1363
|
-
|
|
1364
|
-
|
|
1436
|
+
},
|
|
1437
|
+
)
|
|
1438
|
+
.await?
|
|
1439
|
+
.into_inner())
|
|
1365
1440
|
}
|
|
1366
1441
|
|
|
1367
1442
|
async fn get_search_attributes(&self) -> Result<GetSearchAttributesResponse> {
|
|
1368
|
-
Ok(
|
|
1369
|
-
.
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1443
|
+
Ok(WorkflowService::get_search_attributes(
|
|
1444
|
+
&mut self.inner.client.clone(),
|
|
1445
|
+
GetSearchAttributesRequest {},
|
|
1446
|
+
)
|
|
1447
|
+
.await?
|
|
1448
|
+
.into_inner())
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
async fn update_workflow_execution(
|
|
1452
|
+
&self,
|
|
1453
|
+
workflow_id: String,
|
|
1454
|
+
run_id: String,
|
|
1455
|
+
name: String,
|
|
1456
|
+
wait_policy: update::v1::WaitPolicy,
|
|
1457
|
+
args: Option<Payloads>,
|
|
1458
|
+
) -> Result<UpdateWorkflowExecutionResponse> {
|
|
1459
|
+
Ok(WorkflowService::update_workflow_execution(
|
|
1460
|
+
&mut self.inner.client.clone(),
|
|
1461
|
+
UpdateWorkflowExecutionRequest {
|
|
1462
|
+
namespace: self.namespace.clone(),
|
|
1463
|
+
workflow_execution: Some(WorkflowExecution {
|
|
1464
|
+
workflow_id,
|
|
1465
|
+
run_id,
|
|
1466
|
+
}),
|
|
1467
|
+
wait_policy: Some(wait_policy),
|
|
1468
|
+
request: Some(update::v1::Request {
|
|
1469
|
+
meta: Some(update::v1::Meta {
|
|
1470
|
+
update_id: "".into(),
|
|
1471
|
+
identity: self.inner.options.identity.clone(),
|
|
1472
|
+
}),
|
|
1473
|
+
input: Some(update::v1::Input {
|
|
1474
|
+
header: None,
|
|
1475
|
+
name,
|
|
1476
|
+
args,
|
|
1477
|
+
}),
|
|
1478
|
+
}),
|
|
1479
|
+
..Default::default()
|
|
1480
|
+
},
|
|
1481
|
+
)
|
|
1482
|
+
.await?
|
|
1483
|
+
.into_inner())
|
|
1373
1484
|
}
|
|
1374
1485
|
|
|
1375
1486
|
fn get_options(&self) -> &ClientOptions {
|
|
@@ -1441,4 +1552,27 @@ mod tests {
|
|
|
1441
1552
|
let next_req = iceptor.call(req).unwrap();
|
|
1442
1553
|
assert_eq!(next_req.metadata().get("enchi").unwrap(), "cat");
|
|
1443
1554
|
}
|
|
1555
|
+
|
|
1556
|
+
#[test]
|
|
1557
|
+
fn keep_alive_defaults() {
|
|
1558
|
+
let mut builder = ClientOptionsBuilder::default();
|
|
1559
|
+
builder
|
|
1560
|
+
.identity("enchicat".to_string())
|
|
1561
|
+
.target_url(Url::parse("https://smolkitty").unwrap())
|
|
1562
|
+
.client_name("cute-kitty".to_string())
|
|
1563
|
+
.client_version("0.1.0".to_string());
|
|
1564
|
+
// If unset, defaults to Some
|
|
1565
|
+
let opts = builder.build().unwrap();
|
|
1566
|
+
assert_eq!(
|
|
1567
|
+
opts.keep_alive.clone().unwrap().interval,
|
|
1568
|
+
ClientKeepAliveConfig::default().interval
|
|
1569
|
+
);
|
|
1570
|
+
assert_eq!(
|
|
1571
|
+
opts.keep_alive.clone().unwrap().timeout,
|
|
1572
|
+
ClientKeepAliveConfig::default().timeout
|
|
1573
|
+
);
|
|
1574
|
+
// But can be set to none
|
|
1575
|
+
let opts = builder.keep_alive(None).build().unwrap();
|
|
1576
|
+
assert!(opts.keep_alive.is_none());
|
|
1577
|
+
}
|
|
1444
1578
|
}
|