@temporalio/core-bridge 1.6.0 → 1.7.1
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 +520 -456
- package/lib/index.d.ts +8 -6
- package/lib/index.js.map +1 -1
- package/package.json +8 -3
- 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/.buildkite/docker/Dockerfile +2 -2
- package/sdk-core/.buildkite/docker/docker-compose.yaml +1 -1
- package/sdk-core/.buildkite/pipeline.yml +1 -1
- package/sdk-core/.github/workflows/heavy.yml +1 -0
- package/sdk-core/README.md +13 -7
- package/sdk-core/client/src/lib.rs +27 -9
- package/sdk-core/client/src/metrics.rs +17 -8
- package/sdk-core/client/src/raw.rs +3 -3
- package/sdk-core/core/Cargo.toml +3 -4
- package/sdk-core/core/src/abstractions/take_cell.rs +28 -0
- package/sdk-core/core/src/abstractions.rs +197 -18
- package/sdk-core/core/src/core_tests/activity_tasks.rs +137 -45
- package/sdk-core/core/src/core_tests/child_workflows.rs +6 -5
- package/sdk-core/core/src/core_tests/determinism.rs +212 -2
- package/sdk-core/core/src/core_tests/local_activities.rs +183 -36
- package/sdk-core/core/src/core_tests/queries.rs +32 -14
- package/sdk-core/core/src/core_tests/workers.rs +8 -5
- package/sdk-core/core/src/core_tests/workflow_tasks.rs +340 -51
- package/sdk-core/core/src/ephemeral_server/mod.rs +110 -8
- package/sdk-core/core/src/internal_flags.rs +141 -0
- package/sdk-core/core/src/lib.rs +14 -9
- package/sdk-core/core/src/replay/mod.rs +16 -27
- package/sdk-core/core/src/telemetry/metrics.rs +69 -35
- package/sdk-core/core/src/telemetry/mod.rs +38 -14
- package/sdk-core/core/src/telemetry/prometheus_server.rs +19 -13
- package/sdk-core/core/src/test_help/mod.rs +65 -13
- package/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +119 -160
- package/sdk-core/core/src/worker/activities/activity_task_poller_stream.rs +89 -0
- package/sdk-core/core/src/worker/activities/local_activities.rs +122 -6
- package/sdk-core/core/src/worker/activities.rs +347 -173
- package/sdk-core/core/src/worker/client/mocks.rs +22 -2
- package/sdk-core/core/src/worker/client.rs +18 -2
- package/sdk-core/core/src/worker/mod.rs +137 -44
- package/sdk-core/core/src/worker/workflow/history_update.rs +132 -51
- package/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +207 -166
- package/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +6 -7
- package/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +6 -7
- package/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +157 -82
- package/sdk-core/core/src/worker/workflow/machines/complete_workflow_state_machine.rs +12 -12
- package/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +6 -7
- package/sdk-core/core/src/worker/workflow/machines/fail_workflow_state_machine.rs +13 -15
- package/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +170 -60
- package/sdk-core/core/src/worker/workflow/machines/mod.rs +24 -16
- package/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +6 -8
- package/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +320 -204
- package/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +10 -13
- package/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +15 -23
- package/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +187 -46
- package/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +237 -111
- package/sdk-core/core/src/worker/workflow/machines/workflow_task_state_machine.rs +13 -13
- package/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +10 -6
- package/sdk-core/core/src/worker/workflow/managed_run.rs +81 -62
- package/sdk-core/core/src/worker/workflow/mod.rs +341 -79
- package/sdk-core/core/src/worker/workflow/run_cache.rs +18 -11
- package/sdk-core/core/src/worker/workflow/wft_extraction.rs +15 -3
- package/sdk-core/core/src/worker/workflow/workflow_stream/saved_wf_inputs.rs +2 -0
- package/sdk-core/core/src/worker/workflow/workflow_stream.rs +75 -52
- package/sdk-core/core-api/Cargo.toml +0 -1
- package/sdk-core/core-api/src/lib.rs +13 -7
- package/sdk-core/core-api/src/telemetry.rs +4 -6
- package/sdk-core/core-api/src/worker.rs +5 -0
- package/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +80 -55
- package/sdk-core/fsm/rustfsm_trait/src/lib.rs +22 -68
- package/sdk-core/histories/ends_empty_wft_complete.bin +0 -0
- package/sdk-core/histories/old_change_marker_format.bin +0 -0
- package/sdk-core/protos/api_upstream/.github/CODEOWNERS +2 -1
- package/sdk-core/protos/api_upstream/Makefile +1 -1
- package/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +5 -17
- package/sdk-core/protos/api_upstream/temporal/api/common/v1/message.proto +11 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/command_type.proto +1 -6
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/event_type.proto +6 -6
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +5 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/update.proto +22 -6
- package/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +48 -19
- package/sdk-core/protos/api_upstream/temporal/api/namespace/v1/message.proto +2 -0
- package/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +3 -0
- package/sdk-core/protos/api_upstream/temporal/api/{enums/v1/interaction_type.proto → protocol/v1/message.proto} +29 -11
- package/sdk-core/protos/api_upstream/temporal/api/sdk/v1/task_complete_metadata.proto +63 -0
- package/sdk-core/protos/api_upstream/temporal/api/update/v1/message.proto +111 -0
- package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +59 -28
- package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +2 -2
- package/sdk-core/protos/local/temporal/sdk/core/activity_result/activity_result.proto +7 -8
- package/sdk-core/protos/local/temporal/sdk/core/activity_task/activity_task.proto +10 -7
- package/sdk-core/protos/local/temporal/sdk/core/child_workflow/child_workflow.proto +19 -30
- package/sdk-core/protos/local/temporal/sdk/core/common/common.proto +1 -0
- package/sdk-core/protos/local/temporal/sdk/core/core_interface.proto +1 -0
- package/sdk-core/protos/local/temporal/sdk/core/external_data/external_data.proto +8 -0
- package/sdk-core/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +65 -60
- package/sdk-core/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +85 -84
- package/sdk-core/protos/local/temporal/sdk/core/workflow_completion/workflow_completion.proto +9 -3
- package/sdk-core/sdk/Cargo.toml +1 -1
- package/sdk-core/sdk/src/lib.rs +21 -5
- package/sdk-core/sdk/src/workflow_context/options.rs +7 -1
- package/sdk-core/sdk/src/workflow_context.rs +24 -17
- package/sdk-core/sdk/src/workflow_future.rs +9 -3
- package/sdk-core/sdk-core-protos/src/history_builder.rs +114 -89
- package/sdk-core/sdk-core-protos/src/history_info.rs +6 -1
- package/sdk-core/sdk-core-protos/src/lib.rs +205 -64
- package/sdk-core/test-utils/src/canned_histories.rs +106 -296
- package/sdk-core/test-utils/src/lib.rs +32 -5
- package/sdk-core/tests/heavy_tests.rs +10 -43
- package/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +25 -3
- package/sdk-core/tests/integ_tests/heartbeat_tests.rs +5 -3
- package/sdk-core/tests/integ_tests/metrics_tests.rs +218 -16
- package/sdk-core/tests/integ_tests/polling_tests.rs +3 -8
- package/sdk-core/tests/integ_tests/queries_tests.rs +4 -2
- package/sdk-core/tests/integ_tests/visibility_tests.rs +34 -23
- package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +97 -81
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +1 -0
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +1 -0
- package/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +80 -3
- package/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +5 -1
- package/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +1 -0
- package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +25 -3
- package/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +2 -4
- package/sdk-core/tests/integ_tests/workflow_tests/patches.rs +30 -0
- package/sdk-core/tests/integ_tests/workflow_tests/replay.rs +64 -0
- package/sdk-core/tests/integ_tests/workflow_tests/resets.rs +1 -0
- package/sdk-core/tests/integ_tests/workflow_tests/signals.rs +4 -0
- package/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +3 -1
- package/sdk-core/tests/integ_tests/workflow_tests/timers.rs +7 -2
- package/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +6 -7
- package/sdk-core/tests/integ_tests/workflow_tests.rs +8 -8
- package/sdk-core/tests/main.rs +16 -25
- package/sdk-core/tests/runner.rs +11 -9
- package/src/conversions.rs +14 -8
- package/src/runtime.rs +9 -8
- package/ts/index.ts +8 -6
- package/sdk-core/protos/api_upstream/temporal/api/interaction/v1/message.proto +0 -87
|
@@ -34,6 +34,7 @@ async fn signal_sender(ctx: WfContext) -> WorkflowResult<()> {
|
|
|
34
34
|
async fn sends_signal_to_missing_wf() {
|
|
35
35
|
let wf_name = "sends_signal_to_missing_wf";
|
|
36
36
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
37
|
+
starter.no_remote_activities();
|
|
37
38
|
let mut worker = starter.worker().await;
|
|
38
39
|
worker.register_wf(wf_name.to_owned(), signal_sender);
|
|
39
40
|
|
|
@@ -72,6 +73,7 @@ async fn signal_with_create_wf_receiver(ctx: WfContext) -> WorkflowResult<()> {
|
|
|
72
73
|
#[tokio::test]
|
|
73
74
|
async fn sends_signal_to_other_wf() {
|
|
74
75
|
let mut starter = CoreWfStarter::new("sends_signal_to_other_wf");
|
|
76
|
+
starter.no_remote_activities();
|
|
75
77
|
let mut worker = starter.worker().await;
|
|
76
78
|
worker.register_wf("sender", signal_sender);
|
|
77
79
|
worker.register_wf("receiver", signal_receiver);
|
|
@@ -100,6 +102,7 @@ async fn sends_signal_to_other_wf() {
|
|
|
100
102
|
#[tokio::test]
|
|
101
103
|
async fn sends_signal_with_create_wf() {
|
|
102
104
|
let mut starter = CoreWfStarter::new("sends_signal_with_create_wf");
|
|
105
|
+
starter.no_remote_activities();
|
|
103
106
|
let mut worker = starter.worker().await;
|
|
104
107
|
worker.register_wf("receiver_signal", signal_with_create_wf_receiver);
|
|
105
108
|
|
|
@@ -150,6 +153,7 @@ async fn signals_child(ctx: WfContext) -> WorkflowResult<()> {
|
|
|
150
153
|
#[tokio::test]
|
|
151
154
|
async fn sends_signal_to_child() {
|
|
152
155
|
let mut starter = CoreWfStarter::new("sends_signal_to_child");
|
|
156
|
+
starter.no_remote_activities();
|
|
153
157
|
let mut worker = starter.worker().await;
|
|
154
158
|
worker.register_wf("child_signaler", signals_child);
|
|
155
159
|
worker.register_wf("child_receiver", signal_receiver);
|
|
@@ -12,6 +12,7 @@ use tokio::sync::Barrier;
|
|
|
12
12
|
async fn timer_workflow_not_sticky() {
|
|
13
13
|
let wf_name = "timer_wf_not_sticky";
|
|
14
14
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
15
|
+
starter.no_remote_activities();
|
|
15
16
|
starter.max_cached_workflows(0);
|
|
16
17
|
let mut worker = starter.worker().await;
|
|
17
18
|
worker.register_wf(wf_name.to_owned(), timer_wf);
|
|
@@ -39,6 +40,7 @@ async fn timer_workflow_timeout_on_sticky() {
|
|
|
39
40
|
// on a not-sticky queue
|
|
40
41
|
let wf_name = "timer_workflow_timeout_on_sticky";
|
|
41
42
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
43
|
+
starter.no_remote_activities();
|
|
42
44
|
starter.workflow_options.task_timeout = Some(Duration::from_secs(2));
|
|
43
45
|
let mut worker = starter.worker().await;
|
|
44
46
|
worker.register_wf(wf_name.to_owned(), timer_timeout_wf);
|
|
@@ -53,7 +55,7 @@ async fn timer_workflow_timeout_on_sticky() {
|
|
|
53
55
|
async fn cache_miss_ok() {
|
|
54
56
|
let wf_name = "cache_miss_ok";
|
|
55
57
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
56
|
-
starter.max_wft(1);
|
|
58
|
+
starter.no_remote_activities().max_wft(1);
|
|
57
59
|
let mut worker = starter.worker().await;
|
|
58
60
|
|
|
59
61
|
let barr: &'static Barrier = Box::leak(Box::new(Barrier::new(2)));
|
|
@@ -6,7 +6,8 @@ use temporal_sdk_core_protos::coresdk::{
|
|
|
6
6
|
workflow_completion::WorkflowActivationCompletion,
|
|
7
7
|
};
|
|
8
8
|
use temporal_sdk_core_test_utils::{
|
|
9
|
-
init_core_and_create_wf, start_timer_cmd, CoreWfStarter,
|
|
9
|
+
drain_pollers_and_shutdown, init_core_and_create_wf, start_timer_cmd, CoreWfStarter,
|
|
10
|
+
WorkerTestHelpers,
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
pub async fn timer_wf(command_sink: WfContext) -> WorkflowResult<()> {
|
|
@@ -18,6 +19,7 @@ pub async fn timer_wf(command_sink: WfContext) -> WorkflowResult<()> {
|
|
|
18
19
|
async fn timer_workflow_workflow_driver() {
|
|
19
20
|
let wf_name = "timer_wf_new";
|
|
20
21
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
22
|
+
starter.no_remote_activities();
|
|
21
23
|
let mut worker = starter.worker().await;
|
|
22
24
|
worker.register_wf(wf_name.to_owned(), timer_wf);
|
|
23
25
|
|
|
@@ -29,6 +31,7 @@ async fn timer_workflow_workflow_driver() {
|
|
|
29
31
|
async fn timer_workflow_manual() {
|
|
30
32
|
let mut starter = init_core_and_create_wf("timer_workflow").await;
|
|
31
33
|
let core = starter.get_worker().await;
|
|
34
|
+
starter.no_remote_activities();
|
|
32
35
|
let task = core.poll_workflow_activation().await.unwrap();
|
|
33
36
|
core.complete_workflow_activation(WorkflowActivationCompletion::from_cmds(
|
|
34
37
|
task.run_id,
|
|
@@ -42,13 +45,14 @@ async fn timer_workflow_manual() {
|
|
|
42
45
|
.unwrap();
|
|
43
46
|
let task = core.poll_workflow_activation().await.unwrap();
|
|
44
47
|
core.complete_execution(&task.run_id).await;
|
|
45
|
-
core
|
|
48
|
+
drain_pollers_and_shutdown(&core).await;
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
#[tokio::test]
|
|
49
52
|
async fn timer_cancel_workflow() {
|
|
50
53
|
let mut starter = init_core_and_create_wf("timer_cancel_workflow").await;
|
|
51
54
|
let core = starter.get_worker().await;
|
|
55
|
+
starter.no_remote_activities();
|
|
52
56
|
let task = core.poll_workflow_activation().await.unwrap();
|
|
53
57
|
core.complete_workflow_activation(WorkflowActivationCompletion::from_cmds(
|
|
54
58
|
task.run_id,
|
|
@@ -107,6 +111,7 @@ async fn parallel_timer_wf(command_sink: WfContext) -> WorkflowResult<()> {
|
|
|
107
111
|
async fn parallel_timers() {
|
|
108
112
|
let wf_name = "parallel_timers";
|
|
109
113
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
114
|
+
starter.no_remote_activities();
|
|
110
115
|
let mut worker = starter.worker().await;
|
|
111
116
|
worker.register_wf(wf_name.to_owned(), parallel_timer_wf);
|
|
112
117
|
|
|
@@ -2,7 +2,7 @@ use std::{collections::HashMap, env};
|
|
|
2
2
|
use temporal_client::{WorkflowClientTrait, WorkflowOptions};
|
|
3
3
|
use temporal_sdk::{WfContext, WorkflowResult};
|
|
4
4
|
use temporal_sdk_core_protos::coresdk::{AsJsonPayloadExt, FromJsonPayloadExt};
|
|
5
|
-
use temporal_sdk_core_test_utils::{CoreWfStarter,
|
|
5
|
+
use temporal_sdk_core_test_utils::{CoreWfStarter, INTEG_TEMPORAL_DEV_SERVER_USED_ENV_VAR};
|
|
6
6
|
use tracing::warn;
|
|
7
7
|
use uuid::Uuid;
|
|
8
8
|
|
|
@@ -24,9 +24,11 @@ async fn sends_upsert() {
|
|
|
24
24
|
let wf_name = "sends_upsert_search_attrs";
|
|
25
25
|
let wf_id = Uuid::new_v4();
|
|
26
26
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
27
|
+
starter.no_remote_activities();
|
|
27
28
|
let mut worker = starter.worker().await;
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
// TODO: this should be supported in server 1.20, remove this condition when CLI is upgraded.
|
|
30
|
+
if env::var(INTEG_TEMPORAL_DEV_SERVER_USED_ENV_VAR).is_ok() {
|
|
31
|
+
warn!("skipping sends_upsert -- does not work on temporal dev server");
|
|
30
32
|
return;
|
|
31
33
|
}
|
|
32
34
|
|
|
@@ -62,10 +64,7 @@ async fn sends_upsert() {
|
|
|
62
64
|
let txt_attr_payload = search_attrs.get(TXT_ATTR).unwrap();
|
|
63
65
|
let int_attr_payload = search_attrs.get(INT_ATTR).unwrap();
|
|
64
66
|
for payload in [txt_attr_payload, int_attr_payload] {
|
|
65
|
-
|
|
66
|
-
&b"json/plain".to_vec(),
|
|
67
|
-
payload.metadata.get("encoding").unwrap()
|
|
68
|
-
);
|
|
67
|
+
assert!(payload.is_json_payload());
|
|
69
68
|
}
|
|
70
69
|
assert_eq!(
|
|
71
70
|
"goodbye",
|
|
@@ -42,8 +42,8 @@ use temporal_sdk_core_protos::{
|
|
|
42
42
|
temporal::api::{failure::v1::Failure, history::v1::history_event},
|
|
43
43
|
};
|
|
44
44
|
use temporal_sdk_core_test_utils::{
|
|
45
|
-
history_from_proto_binary, init_core_and_create_wf,
|
|
46
|
-
schedule_activity_cmd, CoreWfStarter, WorkerTestHelpers,
|
|
45
|
+
drain_pollers_and_shutdown, history_from_proto_binary, init_core_and_create_wf,
|
|
46
|
+
init_core_replay_preloaded, schedule_activity_cmd, CoreWfStarter, WorkerTestHelpers,
|
|
47
47
|
};
|
|
48
48
|
use tokio::time::sleep;
|
|
49
49
|
use uuid::Uuid;
|
|
@@ -103,7 +103,7 @@ async fn parallel_workflows_same_queue() {
|
|
|
103
103
|
for handle in handles {
|
|
104
104
|
handle.await.unwrap()
|
|
105
105
|
}
|
|
106
|
-
core
|
|
106
|
+
drain_pollers_and_shutdown(&core).await;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
static RUN_CT: AtomicUsize = AtomicUsize::new(0);
|
|
@@ -117,7 +117,7 @@ pub async fn cache_evictions_wf(command_sink: WfContext) -> WorkflowResult<()> {
|
|
|
117
117
|
async fn workflow_lru_cache_evictions() {
|
|
118
118
|
let wf_type = "workflow_lru_cache_evictions";
|
|
119
119
|
let mut starter = CoreWfStarter::new(wf_type);
|
|
120
|
-
starter.max_cached_workflows(1);
|
|
120
|
+
starter.no_remote_activities().max_cached_workflows(1);
|
|
121
121
|
let mut worker = starter.worker().await;
|
|
122
122
|
worker.register_wf(wf_type.to_string(), cache_evictions_wf);
|
|
123
123
|
|
|
@@ -162,7 +162,7 @@ async fn shutdown_aborts_actively_blocked_poll() {
|
|
|
162
162
|
let tcore = core.clone();
|
|
163
163
|
let handle = tokio::spawn(async move {
|
|
164
164
|
std::thread::sleep(Duration::from_millis(100));
|
|
165
|
-
tcore
|
|
165
|
+
drain_pollers_and_shutdown(&tcore).await;
|
|
166
166
|
});
|
|
167
167
|
assert_matches!(
|
|
168
168
|
core.poll_workflow_activation().await.unwrap_err(),
|
|
@@ -414,11 +414,11 @@ async fn signal_workflow_signal_not_handled_on_workflow_completion() {
|
|
|
414
414
|
res.jobs.as_slice(),
|
|
415
415
|
[
|
|
416
416
|
WorkflowActivationJob {
|
|
417
|
-
variant: Some(workflow_activation_job::Variant::
|
|
417
|
+
variant: Some(workflow_activation_job::Variant::SignalWorkflow(_)),
|
|
418
418
|
},
|
|
419
419
|
WorkflowActivationJob {
|
|
420
|
-
variant: Some(workflow_activation_job::Variant::
|
|
421
|
-
}
|
|
420
|
+
variant: Some(workflow_activation_job::Variant::FireTimer(_)),
|
|
421
|
+
},
|
|
422
422
|
]
|
|
423
423
|
);
|
|
424
424
|
core.complete_execution(&res.run_id).await;
|
package/sdk-core/tests/main.rs
CHANGED
|
@@ -25,7 +25,7 @@ mod integ_tests {
|
|
|
25
25
|
use temporal_sdk_core_api::worker::WorkerConfigBuilder;
|
|
26
26
|
use temporal_sdk_core_protos::temporal::api::workflowservice::v1::ListNamespacesRequest;
|
|
27
27
|
use temporal_sdk_core_test_utils::{
|
|
28
|
-
get_integ_server_options, get_integ_telem_options,
|
|
28
|
+
get_integ_server_options, get_integ_telem_options, init_integ_telem,
|
|
29
29
|
};
|
|
30
30
|
use url::Url;
|
|
31
31
|
|
|
@@ -36,7 +36,7 @@ mod integ_tests {
|
|
|
36
36
|
let opts = get_integ_server_options();
|
|
37
37
|
let runtime = CoreRuntime::new_assume_tokio(get_integ_telem_options()).unwrap();
|
|
38
38
|
let mut retrying_client = opts
|
|
39
|
-
.connect_no_namespace(runtime.metric_meter(), None)
|
|
39
|
+
.connect_no_namespace(runtime.metric_meter().as_deref(), None)
|
|
40
40
|
.await
|
|
41
41
|
.unwrap();
|
|
42
42
|
|
|
@@ -58,35 +58,23 @@ mod integ_tests {
|
|
|
58
58
|
.await;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
// https://github.com/temporalio/customization-samples/tree/master/tls/tls-simple
|
|
61
|
+
// Manually run to verify tls works against cloud. You will need certs in place in the
|
|
62
|
+
// indicated directory.
|
|
64
63
|
#[tokio::test]
|
|
65
64
|
#[ignore]
|
|
66
65
|
async fn tls_test() {
|
|
67
|
-
|
|
68
|
-
let root = tokio::fs::read(
|
|
69
|
-
|
|
70
|
-
)
|
|
71
|
-
.await
|
|
72
|
-
.unwrap();
|
|
73
|
-
let client_cert = tokio::fs::read(
|
|
74
|
-
"/home/sushi/dev/temporal/customization-samples/tls/tls-simple/certs/client.pem",
|
|
75
|
-
)
|
|
76
|
-
.await
|
|
77
|
-
.unwrap();
|
|
78
|
-
let client_private_key = tokio::fs::read(
|
|
79
|
-
"/home/sushi/dev/temporal/customization-samples/tls/tls-simple/certs/client.key",
|
|
80
|
-
)
|
|
81
|
-
.await
|
|
82
|
-
.unwrap();
|
|
66
|
+
init_integ_telem();
|
|
67
|
+
let root = tokio::fs::read("../.cloud_certs/ca.pem").await.unwrap();
|
|
68
|
+
let client_cert = tokio::fs::read("../.cloud_certs/client.pem").await.unwrap();
|
|
69
|
+
let client_private_key = tokio::fs::read("../.cloud_certs/client.key").await.unwrap();
|
|
83
70
|
let sgo = ClientOptionsBuilder::default()
|
|
84
|
-
.target_url(Url::from_str("https://
|
|
71
|
+
.target_url(Url::from_str("https://spencer.temporal-dev.tmprl.cloud:7233").unwrap())
|
|
85
72
|
.client_name("tls_tester")
|
|
86
73
|
.client_version("clientver")
|
|
87
74
|
.tls_cfg(TlsConfig {
|
|
88
75
|
server_root_ca_cert: Some(root),
|
|
89
|
-
|
|
76
|
+
// Not necessary, but illustrates functionality for people using proxies, etc.
|
|
77
|
+
domain: Some("spencer.temporal-dev.tmprl.cloud".to_string()),
|
|
90
78
|
client_tls_config: Some(ClientTlsConfig {
|
|
91
79
|
client_cert,
|
|
92
80
|
client_private_key,
|
|
@@ -95,9 +83,12 @@ mod integ_tests {
|
|
|
95
83
|
.build()
|
|
96
84
|
.unwrap();
|
|
97
85
|
let con = sgo
|
|
98
|
-
.connect(
|
|
86
|
+
.connect("spencer.temporal-dev".to_string(), None, None)
|
|
99
87
|
.await
|
|
100
88
|
.unwrap();
|
|
101
|
-
con
|
|
89
|
+
dbg!(con
|
|
90
|
+
.list_workflow_executions(100, vec![], "".to_string())
|
|
91
|
+
.await
|
|
92
|
+
.unwrap());
|
|
102
93
|
}
|
|
103
94
|
}
|
package/sdk-core/tests/runner.rs
CHANGED
|
@@ -5,9 +5,11 @@ use std::{
|
|
|
5
5
|
path::{Path, PathBuf},
|
|
6
6
|
process::Stdio,
|
|
7
7
|
};
|
|
8
|
-
use temporal_sdk_core::ephemeral_server::{
|
|
8
|
+
use temporal_sdk_core::ephemeral_server::{
|
|
9
|
+
TemporalDevServerConfigBuilder, TestServerConfigBuilder,
|
|
10
|
+
};
|
|
9
11
|
use temporal_sdk_core_test_utils::{
|
|
10
|
-
default_cached_download, INTEG_SERVER_TARGET_ENV_VAR,
|
|
12
|
+
default_cached_download, INTEG_SERVER_TARGET_ENV_VAR, INTEG_TEMPORAL_DEV_SERVER_USED_ENV_VAR,
|
|
11
13
|
INTEG_TEST_SERVER_USED_ENV_VAR,
|
|
12
14
|
};
|
|
13
15
|
use tokio::{self, process::Command};
|
|
@@ -20,7 +22,7 @@ struct Cli {
|
|
|
20
22
|
test_name: String,
|
|
21
23
|
|
|
22
24
|
/// What kind of server to auto-launch, if any
|
|
23
|
-
#[arg(short, long, value_enum, default_value = "
|
|
25
|
+
#[arg(short, long, value_enum, default_value = "temporal-cli")]
|
|
24
26
|
server_kind: ServerKind,
|
|
25
27
|
|
|
26
28
|
/// Arguments to pass through to the `cargo test` command. Ex: `--release`
|
|
@@ -33,8 +35,8 @@ struct Cli {
|
|
|
33
35
|
|
|
34
36
|
#[derive(Copy, Clone, PartialEq, Eq, clap::ValueEnum)]
|
|
35
37
|
enum ServerKind {
|
|
36
|
-
/// Use
|
|
37
|
-
|
|
38
|
+
/// Use Temporal-cli
|
|
39
|
+
TemporalCLI,
|
|
38
40
|
/// Use the Java test server
|
|
39
41
|
TestServer,
|
|
40
42
|
/// Do not automatically start any server
|
|
@@ -65,14 +67,14 @@ async fn main() -> Result<(), anyhow::Error> {
|
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
let (server, envs) = match server_kind {
|
|
68
|
-
ServerKind::
|
|
69
|
-
let config =
|
|
70
|
+
ServerKind::TemporalCLI => {
|
|
71
|
+
let config = TemporalDevServerConfigBuilder::default()
|
|
70
72
|
.exe(default_cached_download())
|
|
71
73
|
.build()?;
|
|
72
|
-
println!("Using
|
|
74
|
+
println!("Using temporal CLI");
|
|
73
75
|
(
|
|
74
76
|
Some(config.start_server_with_output(Stdio::null()).await?),
|
|
75
|
-
vec![(
|
|
77
|
+
vec![(INTEG_TEMPORAL_DEV_SERVER_USED_ENV_VAR, "true")],
|
|
76
78
|
)
|
|
77
79
|
}
|
|
78
80
|
ServerKind::TestServer => {
|
package/src/conversions.rs
CHANGED
|
@@ -14,14 +14,15 @@ use temporal_sdk_core::{
|
|
|
14
14
|
},
|
|
15
15
|
api::worker::{WorkerConfig, WorkerConfigBuilder},
|
|
16
16
|
ephemeral_server::{
|
|
17
|
-
|
|
17
|
+
TemporalDevServerConfig, TemporalDevServerConfigBuilder, TestServerConfig,
|
|
18
|
+
TestServerConfigBuilder,
|
|
18
19
|
},
|
|
19
20
|
ClientOptions, ClientOptionsBuilder, ClientTlsConfig, RetryConfig, TlsConfig, Url,
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
pub enum EphemeralServerConfig {
|
|
23
24
|
TestServer(TestServerConfig),
|
|
24
|
-
|
|
25
|
+
DevServer(TemporalDevServerConfig),
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
pub trait ArrayHandleConversionsExt {
|
|
@@ -323,6 +324,10 @@ impl ObjectHandleConversionsExt for Handle<'_, JsObject> {
|
|
|
323
324
|
js_optional_getter!(cx, self, "maxTaskQueueActivitiesPerSecond", JsNumber)
|
|
324
325
|
.map(|num| num.value(cx) as f64);
|
|
325
326
|
|
|
327
|
+
let graceful_shutdown_period =
|
|
328
|
+
js_optional_getter!(cx, self, "shutdownGraceTimeMs", JsNumber)
|
|
329
|
+
.map(|num| Duration::from_millis(num.value(cx) as u64));
|
|
330
|
+
|
|
326
331
|
match WorkerConfigBuilder::default()
|
|
327
332
|
.worker_build_id(js_value_getter!(cx, self, "buildId", JsString))
|
|
328
333
|
.client_identity_override(Some(js_value_getter!(cx, self, "identity", JsString)))
|
|
@@ -332,6 +337,7 @@ impl ObjectHandleConversionsExt for Handle<'_, JsObject> {
|
|
|
332
337
|
.max_outstanding_local_activities(max_outstanding_local_activities)
|
|
333
338
|
.max_cached_workflows(max_cached_workflows)
|
|
334
339
|
.sticky_queue_schedule_to_start_timeout(sticky_queue_schedule_to_start_timeout)
|
|
340
|
+
.graceful_shutdown_period(graceful_shutdown_period)
|
|
335
341
|
.namespace(namespace)
|
|
336
342
|
.task_queue(task_queue)
|
|
337
343
|
.max_heartbeat_throttle_interval(max_heartbeat_throttle_interval)
|
|
@@ -374,7 +380,7 @@ impl ObjectHandleConversionsExt for Handle<'_, JsObject> {
|
|
|
374
380
|
|
|
375
381
|
let exec_version = match version.as_str() {
|
|
376
382
|
"default" => {
|
|
377
|
-
temporal_sdk_core::ephemeral_server::EphemeralExeVersion::
|
|
383
|
+
temporal_sdk_core::ephemeral_server::EphemeralExeVersion::SDKDefault {
|
|
378
384
|
sdk_name: "sdk-typescript".to_owned(),
|
|
379
385
|
sdk_version,
|
|
380
386
|
}
|
|
@@ -398,8 +404,8 @@ impl ObjectHandleConversionsExt for Handle<'_, JsObject> {
|
|
|
398
404
|
|
|
399
405
|
let server_type = js_value_getter!(cx, self, "type", JsString);
|
|
400
406
|
match server_type.as_str() {
|
|
401
|
-
"
|
|
402
|
-
let mut config =
|
|
407
|
+
"dev-server" => {
|
|
408
|
+
let mut config = TemporalDevServerConfigBuilder::default();
|
|
403
409
|
config.exe(executable).port(port);
|
|
404
410
|
|
|
405
411
|
if let Some(extra_args) = js_optional_getter!(cx, self, "extraArgs", JsArray) {
|
|
@@ -422,9 +428,9 @@ impl ObjectHandleConversionsExt for Handle<'_, JsObject> {
|
|
|
422
428
|
}
|
|
423
429
|
|
|
424
430
|
match config.build() {
|
|
425
|
-
Ok(config) => Ok(EphemeralServerConfig::
|
|
431
|
+
Ok(config) => Ok(EphemeralServerConfig::DevServer(config)),
|
|
426
432
|
Err(err) => {
|
|
427
|
-
cx.throw_type_error(format!("Invalid
|
|
433
|
+
cx.throw_type_error(format!("Invalid dev server config: {:?}", err))
|
|
428
434
|
}
|
|
429
435
|
}
|
|
430
436
|
}
|
|
@@ -445,7 +451,7 @@ impl ObjectHandleConversionsExt for Handle<'_, JsObject> {
|
|
|
445
451
|
}
|
|
446
452
|
}
|
|
447
453
|
s => cx.throw_type_error(format!(
|
|
448
|
-
"Invalid ephemeral server type: {}, expected '
|
|
454
|
+
"Invalid ephemeral server type: {}, expected 'dev-server' or 'time-skipping'",
|
|
449
455
|
s
|
|
450
456
|
)),
|
|
451
457
|
}
|
package/src/runtime.rs
CHANGED
|
@@ -144,13 +144,16 @@ pub fn start_bridge_loop(
|
|
|
144
144
|
headers,
|
|
145
145
|
callback,
|
|
146
146
|
} => {
|
|
147
|
-
// `metrics_meter`
|
|
148
|
-
//
|
|
149
|
-
//
|
|
150
|
-
// us.
|
|
147
|
+
// `metrics_meter` can be None here since we don't use the returned client
|
|
148
|
+
// directly at the moment, when we repurpose the client to be used by a Worker,
|
|
149
|
+
// `init_worker` will attach the correct metrics meter for us.
|
|
151
150
|
core_runtime.tokio_handle().spawn(async move {
|
|
151
|
+
let metrics_meter = None;
|
|
152
152
|
match options
|
|
153
|
-
.connect_no_namespace(
|
|
153
|
+
.connect_no_namespace(
|
|
154
|
+
metrics_meter,
|
|
155
|
+
headers.map(|h| Arc::new(RwLock::new(h))),
|
|
156
|
+
)
|
|
154
157
|
.await
|
|
155
158
|
{
|
|
156
159
|
Err(err) => {
|
|
@@ -270,9 +273,7 @@ pub fn start_bridge_loop(
|
|
|
270
273
|
EphemeralServerConfig::TestServer(config) => {
|
|
271
274
|
config.start_server().await
|
|
272
275
|
}
|
|
273
|
-
EphemeralServerConfig::
|
|
274
|
-
config.start_server().await
|
|
275
|
-
}
|
|
276
|
+
EphemeralServerConfig::DevServer(config) => config.start_server().await,
|
|
276
277
|
};
|
|
277
278
|
match result {
|
|
278
279
|
Err(err) => {
|
package/ts/index.ts
CHANGED
|
@@ -381,10 +381,10 @@ export interface TimeSkippingServerConfig {
|
|
|
381
381
|
}
|
|
382
382
|
|
|
383
383
|
/**
|
|
384
|
-
* Configuration for
|
|
384
|
+
* Configuration for the Temporal CLI dev server.
|
|
385
385
|
*/
|
|
386
|
-
export interface
|
|
387
|
-
type: '
|
|
386
|
+
export interface DevServerConfig {
|
|
387
|
+
type: 'dev-server';
|
|
388
388
|
executable?: EphemeralServerExecutable;
|
|
389
389
|
/**
|
|
390
390
|
* Namespace to use - created at startup.
|
|
@@ -399,11 +399,13 @@ export interface TemporaliteConfig {
|
|
|
399
399
|
*/
|
|
400
400
|
ip?: string;
|
|
401
401
|
/**
|
|
402
|
-
* Sqlite DB filename if persisting or non-persistent if none.
|
|
402
|
+
* Sqlite DB filename if persisting or non-persistent if none (default).
|
|
403
403
|
*/
|
|
404
404
|
db_filename?: string;
|
|
405
405
|
/**
|
|
406
406
|
* Whether to enable the UI.
|
|
407
|
+
*
|
|
408
|
+
* @default false
|
|
407
409
|
*/
|
|
408
410
|
ui?: boolean;
|
|
409
411
|
/**
|
|
@@ -424,9 +426,9 @@ export interface TemporaliteConfig {
|
|
|
424
426
|
/**
|
|
425
427
|
* Configuration for spawning an ephemeral Temporal server.
|
|
426
428
|
*
|
|
427
|
-
* Both the time-skipping test server and
|
|
429
|
+
* Both the time-skipping test server and Temporal CLI dev server are supported.
|
|
428
430
|
*/
|
|
429
|
-
export type EphemeralServerConfig = TimeSkippingServerConfig |
|
|
431
|
+
export type EphemeralServerConfig = TimeSkippingServerConfig | DevServerConfig;
|
|
430
432
|
|
|
431
433
|
export interface Worker {
|
|
432
434
|
type: 'Worker';
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
// The MIT License
|
|
2
|
-
//
|
|
3
|
-
// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved.
|
|
4
|
-
//
|
|
5
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
// in the Software without restriction, including without limitation the rights
|
|
8
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
// furnished to do so, subject to the following conditions:
|
|
11
|
-
//
|
|
12
|
-
// The above copyright notice and this permission notice shall be included in
|
|
13
|
-
// all copies or substantial portions of the Software.
|
|
14
|
-
//
|
|
15
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
// THE SOFTWARE.
|
|
22
|
-
|
|
23
|
-
syntax = "proto3";
|
|
24
|
-
|
|
25
|
-
package temporal.api.interaction.v1;
|
|
26
|
-
|
|
27
|
-
option go_package = "go.temporal.io/api/interaction/v1;interaction";
|
|
28
|
-
option java_package = "io.temporal.api.interaction.v1";
|
|
29
|
-
option java_multiple_files = true;
|
|
30
|
-
option java_outer_classname = "MessageProto";
|
|
31
|
-
option ruby_package = "Temporalio::Api::Interaction::V1";
|
|
32
|
-
option csharp_namespace = "Temporalio.Api.Interaction.V1";
|
|
33
|
-
|
|
34
|
-
import "temporal/api/common/v1/message.proto";
|
|
35
|
-
import "temporal/api/failure/v1/message.proto";
|
|
36
|
-
import "temporal/api/enums/v1/interaction_type.proto";
|
|
37
|
-
|
|
38
|
-
// Meta carries metadata about an interaction for use by the system (i.e. not
|
|
39
|
-
// generall user-visible)
|
|
40
|
-
message Meta {
|
|
41
|
-
// An ID with workflow-scoped uniqueness for this interaction
|
|
42
|
-
string id = 1;
|
|
43
|
-
|
|
44
|
-
// The event ID after which this interaction can execute. The effects of
|
|
45
|
-
// history up to and including this event ID should be visible to the
|
|
46
|
-
// interaction when it executes.
|
|
47
|
-
int64 event_id = 2;
|
|
48
|
-
|
|
49
|
-
// The type of this interaction.
|
|
50
|
-
temporal.api.enums.v1.InteractionType interaction_type = 3;
|
|
51
|
-
|
|
52
|
-
// A string identifying the agent that requested this interaction.
|
|
53
|
-
string identity = 4;
|
|
54
|
-
|
|
55
|
-
string request_id = 5;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Input carries interaction input that comes from the caller.
|
|
59
|
-
message Input {
|
|
60
|
-
// Headers that are passed with the interaction to and from the processing workflow.
|
|
61
|
-
// These can include things like auth or tracing tokens.
|
|
62
|
-
temporal.api.common.v1.Header header = 1;
|
|
63
|
-
|
|
64
|
-
// The name of the input handler to invoke on the target workflow
|
|
65
|
-
string name = 2;
|
|
66
|
-
|
|
67
|
-
// The arguments to pass to the named handler.
|
|
68
|
-
temporal.api.common.v1.Payloads args = 3;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
// Output carries the output data from an interaction.
|
|
73
|
-
message Output {
|
|
74
|
-
// Headers that are passed with the interaction to and from the processing workflow.
|
|
75
|
-
// These can include things like auth or tracing tokens.
|
|
76
|
-
temporal.api.common.v1.Header header = 1;
|
|
77
|
-
|
|
78
|
-
oneof result {
|
|
79
|
-
temporal.api.common.v1.Payloads success = 2;
|
|
80
|
-
temporal.api.failure.v1.Failure failure = 3;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
message Invocation {
|
|
85
|
-
Meta meta = 1;
|
|
86
|
-
Input input = 2;
|
|
87
|
-
}
|