@temporalio/core-bridge 0.16.4 → 0.18.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 +339 -226
- package/Cargo.toml +7 -3
- package/common.js +50 -0
- package/index.d.ts +7 -0
- package/index.js +12 -0
- package/package.json +7 -4
- package/releases/aarch64-apple-darwin/index.node +0 -0
- package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
- package/{index.node → releases/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/scripts/build.js +10 -50
- package/sdk-core/.buildkite/docker/Dockerfile +1 -1
- package/sdk-core/.buildkite/docker/docker-compose.yaml +2 -2
- package/sdk-core/.buildkite/pipeline.yml +2 -0
- package/sdk-core/Cargo.toml +1 -88
- package/sdk-core/README.md +30 -6
- package/sdk-core/bridge-ffi/Cargo.toml +24 -0
- package/sdk-core/bridge-ffi/LICENSE.txt +23 -0
- package/sdk-core/bridge-ffi/build.rs +25 -0
- package/sdk-core/bridge-ffi/include/sdk-core-bridge.h +216 -0
- package/sdk-core/bridge-ffi/src/lib.rs +829 -0
- package/sdk-core/bridge-ffi/src/wrappers.rs +193 -0
- package/sdk-core/client/Cargo.toml +32 -0
- package/sdk-core/{src/pollers/gateway.rs → client/src/lib.rs} +101 -195
- package/sdk-core/client/src/metrics.rs +89 -0
- package/sdk-core/client/src/mocks.rs +167 -0
- package/sdk-core/{src/pollers → client/src}/retry.rs +172 -14
- package/sdk-core/core/Cargo.toml +96 -0
- package/sdk-core/{src → core/src}/core_tests/activity_tasks.rs +193 -37
- package/sdk-core/{src → core/src}/core_tests/child_workflows.rs +14 -14
- package/sdk-core/{src → core/src}/core_tests/determinism.rs +8 -8
- package/sdk-core/core/src/core_tests/local_activities.rs +328 -0
- package/sdk-core/{src → core/src}/core_tests/mod.rs +6 -9
- package/sdk-core/{src → core/src}/core_tests/queries.rs +54 -54
- package/sdk-core/{src → core/src}/core_tests/replay_flag.rs +8 -12
- package/sdk-core/{src → core/src}/core_tests/workers.rs +120 -33
- package/sdk-core/{src → core/src}/core_tests/workflow_cancels.rs +16 -26
- package/sdk-core/{src → core/src}/core_tests/workflow_tasks.rs +280 -292
- package/sdk-core/core/src/lib.rs +374 -0
- package/sdk-core/{src → core/src}/log_export.rs +3 -27
- package/sdk-core/core/src/pending_activations.rs +162 -0
- package/sdk-core/{src → core/src}/pollers/mod.rs +4 -22
- package/sdk-core/{src → core/src}/pollers/poll_buffer.rs +1 -1
- package/sdk-core/core/src/protosext/mod.rs +396 -0
- package/sdk-core/core/src/replay/mod.rs +210 -0
- package/sdk-core/core/src/retry_logic.rs +144 -0
- package/sdk-core/{src → core/src}/telemetry/metrics.rs +3 -58
- package/sdk-core/{src → core/src}/telemetry/mod.rs +8 -8
- package/sdk-core/{src → core/src}/telemetry/prometheus_server.rs +0 -0
- package/sdk-core/{src → core/src}/test_help/mod.rs +35 -83
- package/sdk-core/{src → core/src}/worker/activities/activity_heartbeat_manager.rs +95 -42
- package/sdk-core/core/src/worker/activities/local_activities.rs +973 -0
- package/sdk-core/{src → core/src}/worker/activities.rs +52 -33
- package/sdk-core/{src → core/src}/worker/dispatcher.rs +8 -6
- package/sdk-core/{src → core/src}/worker/mod.rs +347 -221
- package/sdk-core/core/src/worker/wft_delivery.rs +81 -0
- package/sdk-core/{src → core/src}/workflow/bridge.rs +5 -2
- package/sdk-core/{src → core/src}/workflow/driven_workflow.rs +17 -7
- package/sdk-core/{src → core/src}/workflow/history_update.rs +33 -7
- package/sdk-core/{src → core/src/workflow}/machines/activity_state_machine.rs +26 -26
- package/sdk-core/{src → core/src/workflow}/machines/cancel_external_state_machine.rs +8 -11
- package/sdk-core/{src → core/src/workflow}/machines/cancel_workflow_state_machine.rs +19 -21
- package/sdk-core/{src → core/src/workflow}/machines/child_workflow_state_machine.rs +20 -31
- package/sdk-core/{src → core/src/workflow}/machines/complete_workflow_state_machine.rs +3 -5
- package/sdk-core/{src → core/src/workflow}/machines/continue_as_new_workflow_state_machine.rs +18 -18
- package/sdk-core/{src → core/src/workflow}/machines/fail_workflow_state_machine.rs +5 -6
- package/sdk-core/core/src/workflow/machines/local_activity_state_machine.rs +1451 -0
- package/sdk-core/{src → core/src/workflow}/machines/mod.rs +54 -107
- package/sdk-core/{src → core/src/workflow}/machines/mutable_side_effect_state_machine.rs +0 -0
- package/sdk-core/{src → core/src/workflow}/machines/patch_state_machine.rs +29 -30
- package/sdk-core/{src → core/src/workflow}/machines/side_effect_state_machine.rs +0 -0
- package/sdk-core/{src → core/src/workflow}/machines/signal_external_state_machine.rs +17 -19
- package/sdk-core/{src → core/src/workflow}/machines/timer_state_machine.rs +20 -21
- package/sdk-core/{src → core/src/workflow}/machines/transition_coverage.rs +5 -2
- package/sdk-core/{src → core/src/workflow}/machines/upsert_search_attributes_state_machine.rs +0 -0
- package/sdk-core/core/src/workflow/machines/workflow_machines/local_acts.rs +96 -0
- package/sdk-core/{src → core/src/workflow}/machines/workflow_machines.rs +357 -171
- package/sdk-core/{src → core/src/workflow}/machines/workflow_task_state_machine.rs +1 -1
- package/sdk-core/{src → core/src}/workflow/mod.rs +200 -39
- package/sdk-core/{src → core/src}/workflow/workflow_tasks/cache_manager.rs +0 -0
- package/sdk-core/{src → core/src}/workflow/workflow_tasks/concurrency_manager.rs +38 -5
- package/sdk-core/{src → core/src}/workflow/workflow_tasks/mod.rs +317 -103
- package/sdk-core/{test_utils → core-api}/Cargo.toml +10 -7
- package/sdk-core/{src → core-api/src}/errors.rs +42 -92
- package/sdk-core/core-api/src/lib.rs +158 -0
- package/sdk-core/{src/worker/config.rs → core-api/src/worker.rs} +18 -23
- package/sdk-core/etc/deps.svg +156 -0
- package/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +5 -5
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +3 -5
- package/sdk-core/fsm/rustfsm_trait/src/lib.rs +7 -1
- package/sdk-core/histories/fail_wf_task.bin +0 -0
- package/sdk-core/histories/timer_workflow_history.bin +0 -0
- package/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +44 -13
- package/sdk-core/protos/api_upstream/temporal/api/common/v1/message.proto +19 -1
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/common.proto +1 -1
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +9 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/namespace.proto +1 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/reset.proto +1 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +13 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/workflow.proto +14 -7
- package/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +176 -18
- package/sdk-core/protos/api_upstream/temporal/api/namespace/v1/message.proto +6 -0
- package/sdk-core/protos/api_upstream/temporal/api/query/v1/message.proto +11 -0
- package/sdk-core/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +3 -0
- package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +156 -7
- package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +135 -104
- package/sdk-core/protos/local/temporal/sdk/core/activity_result/activity_result.proto +78 -0
- package/sdk-core/protos/local/temporal/sdk/core/activity_task/activity_task.proto +78 -0
- package/sdk-core/protos/local/temporal/sdk/core/bridge/bridge.proto +205 -0
- package/sdk-core/protos/local/temporal/sdk/core/bridge/service.proto +61 -0
- package/sdk-core/protos/local/{child_workflow.proto → temporal/sdk/core/child_workflow/child_workflow.proto} +1 -1
- package/sdk-core/protos/local/{common.proto → temporal/sdk/core/common/common.proto} +5 -3
- package/sdk-core/protos/local/{core_interface.proto → temporal/sdk/core/core_interface.proto} +10 -10
- package/sdk-core/protos/local/temporal/sdk/core/external_data/external_data.proto +30 -0
- package/sdk-core/protos/local/{workflow_activation.proto → temporal/sdk/core/workflow_activation/workflow_activation.proto} +35 -11
- package/sdk-core/protos/local/{workflow_commands.proto → temporal/sdk/core/workflow_commands/workflow_commands.proto} +55 -4
- package/sdk-core/protos/local/{workflow_completion.proto → temporal/sdk/core/workflow_completion/workflow_completion.proto} +3 -3
- package/sdk-core/sdk/Cargo.toml +32 -0
- package/sdk-core/{src/prototype_rust_sdk → sdk/src}/conversions.rs +0 -0
- package/sdk-core/sdk/src/lib.rs +699 -0
- package/sdk-core/sdk/src/payload_converter.rs +11 -0
- package/sdk-core/sdk/src/workflow_context/options.rs +180 -0
- package/sdk-core/{src/prototype_rust_sdk → sdk/src}/workflow_context.rs +201 -124
- package/sdk-core/{src/prototype_rust_sdk → sdk/src}/workflow_future.rs +63 -30
- package/sdk-core/sdk-core-protos/Cargo.toml +10 -0
- package/sdk-core/sdk-core-protos/build.rs +28 -6
- package/sdk-core/sdk-core-protos/src/constants.rs +7 -0
- package/sdk-core/{src/test_help → sdk-core-protos/src}/history_builder.rs +134 -49
- package/sdk-core/sdk-core-protos/src/history_info.rs +216 -0
- package/sdk-core/sdk-core-protos/src/lib.rs +601 -168
- package/sdk-core/sdk-core-protos/src/task_token.rs +38 -0
- package/sdk-core/sdk-core-protos/src/utilities.rs +14 -0
- package/sdk-core/test-utils/Cargo.toml +32 -0
- package/sdk-core/{src/test_help → test-utils/src}/canned_histories.rs +59 -78
- package/sdk-core/test-utils/src/histfetch.rs +28 -0
- package/sdk-core/{test_utils → test-utils}/src/lib.rs +131 -68
- package/sdk-core/tests/integ_tests/client_tests.rs +1 -1
- package/sdk-core/tests/integ_tests/heartbeat_tests.rs +11 -7
- package/sdk-core/tests/integ_tests/polling_tests.rs +12 -11
- package/sdk-core/tests/integ_tests/queries_tests.rs +82 -78
- package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +91 -71
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +3 -4
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +2 -4
- package/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +4 -6
- package/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +4 -6
- package/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +3 -4
- package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +496 -0
- package/sdk-core/tests/integ_tests/workflow_tests/patches.rs +5 -8
- package/sdk-core/tests/integ_tests/workflow_tests/replay.rs +125 -0
- package/sdk-core/tests/integ_tests/workflow_tests/signals.rs +7 -13
- package/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +33 -5
- package/sdk-core/tests/integ_tests/workflow_tests/timers.rs +12 -16
- package/sdk-core/tests/integ_tests/workflow_tests.rs +85 -82
- package/sdk-core/tests/load_tests.rs +6 -6
- package/sdk-core/tests/main.rs +2 -2
- package/src/conversions.rs +24 -21
- package/src/errors.rs +8 -0
- package/src/lib.rs +323 -211
- package/sdk-core/protos/local/activity_result.proto +0 -46
- package/sdk-core/protos/local/activity_task.proto +0 -66
- package/sdk-core/src/core_tests/retry.rs +0 -147
- package/sdk-core/src/lib.rs +0 -403
- package/sdk-core/src/machines/local_activity_state_machine.rs +0 -117
- package/sdk-core/src/pending_activations.rs +0 -249
- package/sdk-core/src/protosext/mod.rs +0 -160
- package/sdk-core/src/prototype_rust_sdk.rs +0 -412
- package/sdk-core/src/task_token.rs +0 -20
- package/sdk-core/src/test_help/history_info.rs +0 -157
|
@@ -34,17 +34,24 @@ option csharp_namespace = "Temporal.Api.WorkflowService.V1";
|
|
|
34
34
|
|
|
35
35
|
import "temporal/api/workflowservice/v1/request_response.proto";
|
|
36
36
|
|
|
37
|
-
// WorkflowService API
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
//
|
|
37
|
+
// WorkflowService API defines how Temporal SDKs and other clients interact with the Temporal server
|
|
38
|
+
// to create and interact with workflows and activities.
|
|
39
|
+
//
|
|
40
|
+
// Users are expected to call `StartWorkflowExecution` to create a new workflow execution.
|
|
41
|
+
//
|
|
42
|
+
// To drive workflows, a worker using a Temporal SDK must exist which regularly polls for workflow
|
|
43
|
+
// and activity tasks from the service. For each workflow task, the sdk must process the
|
|
44
|
+
// (incremental or complete) event history and respond back with any newly generated commands.
|
|
45
|
+
//
|
|
46
|
+
// For each activity task, the worker is expected to execute the user's code which implements that
|
|
47
|
+
// activity, responding with completion or failure.
|
|
43
48
|
service WorkflowService {
|
|
44
49
|
|
|
45
|
-
// RegisterNamespace creates a new namespace which can be used as a container for all resources.
|
|
46
|
-
//
|
|
47
|
-
//
|
|
50
|
+
// RegisterNamespace creates a new namespace which can be used as a container for all resources.
|
|
51
|
+
//
|
|
52
|
+
// A Namespace is a top level entity within Temporal, and is used as a container for resources
|
|
53
|
+
// like workflow executions, task queues, etc. A Namespace acts as a sandbox and provides
|
|
54
|
+
// isolation for all resources within the namespace. All resources belongs to exactly one
|
|
48
55
|
// namespace.
|
|
49
56
|
rpc RegisterNamespace (RegisterNamespaceRequest) returns (RegisterNamespaceResponse) {
|
|
50
57
|
}
|
|
@@ -57,169 +64,189 @@ service WorkflowService {
|
|
|
57
64
|
rpc ListNamespaces (ListNamespacesRequest) returns (ListNamespacesResponse) {
|
|
58
65
|
}
|
|
59
66
|
|
|
67
|
+
// UpdateNamespace is used to update the information and configuration of a registered
|
|
68
|
+
// namespace.
|
|
69
|
+
//
|
|
60
70
|
// (-- api-linter: core::0134::method-signature=disabled
|
|
61
71
|
// aip.dev/not-precedent: UpdateNamespace RPC doesn't follow Google API format. --)
|
|
62
72
|
// (-- api-linter: core::0134::response-message-name=disabled
|
|
63
73
|
// aip.dev/not-precedent: UpdateNamespace RPC doesn't follow Google API format. --)
|
|
64
|
-
// UpdateNamespace is used to update the information and configuration for a registered namespace.
|
|
65
74
|
rpc UpdateNamespace (UpdateNamespaceRequest) returns (UpdateNamespaceResponse) {
|
|
66
75
|
}
|
|
67
76
|
|
|
68
|
-
// DeprecateNamespace is used to update state of a registered namespace to DEPRECATED.
|
|
69
|
-
//
|
|
70
|
-
// deprecated
|
|
77
|
+
// DeprecateNamespace is used to update the state of a registered namespace to DEPRECATED.
|
|
78
|
+
//
|
|
79
|
+
// Once the namespace is deprecated it cannot be used to start new workflow executions. Existing
|
|
80
|
+
// workflow executions will continue to run on deprecated namespaces.
|
|
81
|
+
// Deprecated.
|
|
71
82
|
rpc DeprecateNamespace (DeprecateNamespaceRequest) returns (DeprecateNamespaceResponse) {
|
|
72
83
|
}
|
|
73
84
|
|
|
74
|
-
// StartWorkflowExecution starts a new
|
|
75
|
-
//
|
|
76
|
-
//
|
|
77
|
-
//
|
|
85
|
+
// StartWorkflowExecution starts a new workflow execution.
|
|
86
|
+
//
|
|
87
|
+
// It will create the execution with a `WORKFLOW_EXECUTION_STARTED` event in its history and
|
|
88
|
+
// also schedule the first workflow task. Returns `WorkflowExecutionAlreadyStarted`, if an
|
|
89
|
+
// instance already exists with same workflow id.
|
|
78
90
|
rpc StartWorkflowExecution (StartWorkflowExecutionRequest) returns (StartWorkflowExecutionResponse) {
|
|
79
91
|
}
|
|
80
92
|
|
|
81
|
-
// GetWorkflowExecutionHistory returns the history of specified workflow execution.
|
|
82
|
-
// execution
|
|
93
|
+
// GetWorkflowExecutionHistory returns the history of specified workflow execution. Fails with
|
|
94
|
+
// `NotFound` if the specified workflow execution is unknown to the service.
|
|
83
95
|
rpc GetWorkflowExecutionHistory (GetWorkflowExecutionHistoryRequest) returns (GetWorkflowExecutionHistoryResponse) {
|
|
84
96
|
}
|
|
85
97
|
|
|
86
|
-
// PollWorkflowTaskQueue is called by
|
|
87
|
-
//
|
|
88
|
-
//
|
|
89
|
-
//
|
|
90
|
-
//
|
|
98
|
+
// PollWorkflowTaskQueue is called by workers to make progress on workflows.
|
|
99
|
+
//
|
|
100
|
+
// A WorkflowTask is dispatched to callers for active workflow executions with pending workflow
|
|
101
|
+
// tasks. The worker is expected to call `RespondWorkflowTaskCompleted` when it is done
|
|
102
|
+
// processing the task. The service will create a `WorkflowTaskStarted` event in the history for
|
|
103
|
+
// this task before handing it to the worker.
|
|
91
104
|
rpc PollWorkflowTaskQueue (PollWorkflowTaskQueueRequest) returns (PollWorkflowTaskQueueResponse) {
|
|
92
105
|
}
|
|
93
106
|
|
|
94
|
-
// RespondWorkflowTaskCompleted is called by
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
//
|
|
107
|
+
// RespondWorkflowTaskCompleted is called by workers to successfully complete workflow tasks
|
|
108
|
+
// they received from `PollWorkflowTaskQueue`.
|
|
109
|
+
//
|
|
110
|
+
// Completing a WorkflowTask will write a `WORKFLOW_TASK_COMPLETED` event to the workflow's
|
|
111
|
+
// history, along with events corresponding to whatever commands the SDK generated while
|
|
112
|
+
// executing the task (ex timer started, activity task scheduled, etc).
|
|
100
113
|
rpc RespondWorkflowTaskCompleted (RespondWorkflowTaskCompletedRequest) returns (RespondWorkflowTaskCompletedResponse) {
|
|
101
114
|
}
|
|
102
115
|
|
|
103
|
-
// RespondWorkflowTaskFailed is called by
|
|
104
|
-
//
|
|
105
|
-
//
|
|
106
|
-
//
|
|
116
|
+
// RespondWorkflowTaskFailed is called by workers to indicate the processing of a workflow task
|
|
117
|
+
// failed.
|
|
118
|
+
//
|
|
119
|
+
// This results in a `WORKFLOW_TASK_FAILED` event written to the history, and a new workflow
|
|
120
|
+
// task will be scheduled. This API can be used to report unhandled failures resulting from
|
|
121
|
+
// applying the workflow task.
|
|
122
|
+
//
|
|
123
|
+
// Temporal will only append first WorkflowTaskFailed event to the history of workflow execution
|
|
124
|
+
// for consecutive failures.
|
|
107
125
|
rpc RespondWorkflowTaskFailed (RespondWorkflowTaskFailedRequest) returns (RespondWorkflowTaskFailedResponse) {
|
|
108
126
|
}
|
|
109
127
|
|
|
110
|
-
// PollActivityTaskQueue is called by
|
|
111
|
-
//
|
|
112
|
-
//
|
|
128
|
+
// PollActivityTaskQueue is called by workers to process activity tasks from a specific task
|
|
129
|
+
// queue.
|
|
130
|
+
//
|
|
131
|
+
// The worker is expected to call one of the `RespondActivityTaskXXX` methods when it is done
|
|
113
132
|
// processing the task.
|
|
114
|
-
//
|
|
115
|
-
//
|
|
116
|
-
//
|
|
117
|
-
//
|
|
118
|
-
//
|
|
133
|
+
//
|
|
134
|
+
// An activity task is dispatched whenever a `SCHEDULE_ACTIVITY_TASK` command is produced during
|
|
135
|
+
// workflow execution. An in memory `ACTIVITY_TASK_STARTED` event is written to mutable state
|
|
136
|
+
// before the task is dispatched to the worker. The started event, and the final event
|
|
137
|
+
// (`ACTIVITY_TASK_COMPLETED` / `ACTIVITY_TASK_FAILED` / `ACTIVITY_TASK_TIMED_OUT`) will both be
|
|
138
|
+
// written permanently to Workflow execution history when Activity is finished. This is done to
|
|
139
|
+
// avoid writing many events in the case of a failure/retry loop.
|
|
119
140
|
rpc PollActivityTaskQueue (PollActivityTaskQueueRequest) returns (PollActivityTaskQueueResponse) {
|
|
120
141
|
}
|
|
121
142
|
|
|
122
|
-
// RecordActivityTaskHeartbeat is called by
|
|
123
|
-
//
|
|
124
|
-
//
|
|
125
|
-
//
|
|
126
|
-
//
|
|
143
|
+
// RecordActivityTaskHeartbeat is optionally called by workers while they execute activities.
|
|
144
|
+
//
|
|
145
|
+
// If worker fails to heartbeat within the `heartbeat_timeout` interval for the activity task,
|
|
146
|
+
// then it will be marked as timed out and an `ACTIVITY_TASK_TIMED_OUT` event will be written to
|
|
147
|
+
// the workflow history. Calling `RecordActivityTaskHeartbeat` will fail with `NotFound` in
|
|
148
|
+
// such situations, in that event, the SDK should request cancellation of the activity.
|
|
127
149
|
rpc RecordActivityTaskHeartbeat (RecordActivityTaskHeartbeatRequest) returns (RecordActivityTaskHeartbeatResponse) {
|
|
128
150
|
}
|
|
129
151
|
|
|
152
|
+
// See `RecordActivityTaskHeartbeat`. This version allows clients to record heartbeats by
|
|
153
|
+
// namespace/workflow id/activity id instead of task token.
|
|
154
|
+
//
|
|
130
155
|
// (-- api-linter: core::0136::prepositions=disabled
|
|
131
156
|
// aip.dev/not-precedent: "By" is used to indicate request type. --)
|
|
132
|
-
// RecordActivityTaskHeartbeatById is called by application worker while it is processing an ActivityTask. If worker fails
|
|
133
|
-
// to heartbeat within 'heartbeatTimeoutSeconds' interval for the ActivityTask, then it will be marked as timed out and
|
|
134
|
-
// 'ActivityTaskTimedOut' event will be written to the workflow history. Calling 'RecordActivityTaskHeartbeatById' will
|
|
135
|
-
// fail with 'NotFoundFailure' in such situations. Instead of using 'taskToken' like in RecordActivityTaskHeartbeat,
|
|
136
|
-
// use Namespace, WorkflowId and ActivityId
|
|
137
157
|
rpc RecordActivityTaskHeartbeatById (RecordActivityTaskHeartbeatByIdRequest) returns (RecordActivityTaskHeartbeatByIdResponse) {
|
|
138
158
|
}
|
|
139
159
|
|
|
140
|
-
// RespondActivityTaskCompleted is called by
|
|
141
|
-
//
|
|
142
|
-
//
|
|
143
|
-
//
|
|
144
|
-
//
|
|
160
|
+
// RespondActivityTaskCompleted is called by workers when they successfully complete an activity
|
|
161
|
+
// task.
|
|
162
|
+
//
|
|
163
|
+
// This results in a new `ACTIVITY_TASK_COMPLETED` event being written to the workflow history
|
|
164
|
+
// and a new workflow task created for the workflow. Fails with `NotFound` if the task token is
|
|
165
|
+
// no longer valid due to activity timeout, already being completed, or never having existed.
|
|
145
166
|
rpc RespondActivityTaskCompleted (RespondActivityTaskCompletedRequest) returns (RespondActivityTaskCompletedResponse) {
|
|
146
167
|
}
|
|
147
168
|
|
|
169
|
+
// See `RecordActivityTaskCompleted`. This version allows clients to record completions by
|
|
170
|
+
// namespace/workflow id/activity id instead of task token.
|
|
171
|
+
//
|
|
148
172
|
// (-- api-linter: core::0136::prepositions=disabled
|
|
149
173
|
// aip.dev/not-precedent: "By" is used to indicate request type. --)
|
|
150
|
-
// RespondActivityTaskCompletedById is called by application worker when it is done processing an ActivityTask.
|
|
151
|
-
// It will result in a new 'ActivityTaskCompleted' event being written to the workflow history and a new WorkflowTask
|
|
152
|
-
// created for the workflow so new commands could be made. Similar to RespondActivityTaskCompleted but use Namespace,
|
|
153
|
-
// WorkflowId and ActivityId instead of 'taskToken' for completion. It fails with 'NotFoundFailure'
|
|
154
|
-
// if the these Ids are not valid anymore due to activity timeout.
|
|
155
174
|
rpc RespondActivityTaskCompletedById (RespondActivityTaskCompletedByIdRequest) returns (RespondActivityTaskCompletedByIdResponse) {
|
|
156
175
|
}
|
|
157
176
|
|
|
158
|
-
// RespondActivityTaskFailed is called by
|
|
159
|
-
//
|
|
160
|
-
//
|
|
161
|
-
//
|
|
162
|
-
//
|
|
177
|
+
// RespondActivityTaskFailed is called by workers when processing an activity task fails.
|
|
178
|
+
//
|
|
179
|
+
// This results in a new `ACTIVITY_TASK_FAILED` event being written to the workflow history and
|
|
180
|
+
// a new workflow task created for the workflow. Fails with `NotFound` if the task token is no
|
|
181
|
+
// longer valid due to activity timeout, already being completed, or never having existed.
|
|
163
182
|
rpc RespondActivityTaskFailed (RespondActivityTaskFailedRequest) returns (RespondActivityTaskFailedResponse) {
|
|
164
183
|
}
|
|
165
184
|
|
|
185
|
+
// See `RecordActivityTaskFailed`. This version allows clients to record failures by
|
|
186
|
+
// namespace/workflow id/activity id instead of task token.
|
|
187
|
+
//
|
|
166
188
|
// (-- api-linter: core::0136::prepositions=disabled
|
|
167
189
|
// aip.dev/not-precedent: "By" is used to indicate request type. --)
|
|
168
|
-
// RespondActivityTaskFailedById is called by application worker when it is done processing an ActivityTask.
|
|
169
|
-
// It will result in a new 'ActivityTaskFailed' event being written to the workflow history and a new WorkflowTask
|
|
170
|
-
// created for the workflow instance so new commands could be made. Similar to RespondActivityTaskFailed but use
|
|
171
|
-
// Namespace, WorkflowId and ActivityId instead of 'taskToken' for completion. It fails with 'NotFoundFailure'
|
|
172
|
-
// if the these Ids are not valid anymore due to activity timeout.
|
|
173
190
|
rpc RespondActivityTaskFailedById (RespondActivityTaskFailedByIdRequest) returns (RespondActivityTaskFailedByIdResponse) {
|
|
174
191
|
}
|
|
175
192
|
|
|
176
|
-
//
|
|
177
|
-
//
|
|
178
|
-
//
|
|
179
|
-
//
|
|
180
|
-
//
|
|
193
|
+
// RespondActivityTaskFailed is called by workers when processing an activity task fails.
|
|
194
|
+
//
|
|
195
|
+
// This results in a new `ACTIVITY_TASK_CANCELED` event being written to the workflow history
|
|
196
|
+
// and a new workflow task created for the workflow. Fails with `NotFound` if the task token is
|
|
197
|
+
// no longer valid due to activity timeout, already being completed, or never having existed.
|
|
181
198
|
rpc RespondActivityTaskCanceled (RespondActivityTaskCanceledRequest) returns (RespondActivityTaskCanceledResponse) {
|
|
182
199
|
}
|
|
183
200
|
|
|
201
|
+
// See `RecordActivityTaskCanceled`. This version allows clients to record failures by
|
|
202
|
+
// namespace/workflow id/activity id instead of task token.
|
|
203
|
+
//
|
|
184
204
|
// (-- api-linter: core::0136::prepositions=disabled
|
|
185
205
|
// aip.dev/not-precedent: "By" is used to indicate request type. --)
|
|
186
|
-
// RespondActivityTaskCanceledById is called by application worker when it is successfully canceled an ActivityTask.
|
|
187
|
-
// It will result in a new 'ActivityTaskCanceled' event being written to the workflow history and a new WorkflowTask
|
|
188
|
-
// created for the workflow instance so new commands could be made. Similar to RespondActivityTaskCanceled but use
|
|
189
|
-
// Namespace, WorkflowId and ActivityId instead of 'taskToken' for completion. It fails with 'NotFoundFailure'
|
|
190
|
-
// if the these Ids are not valid anymore due to activity timeout.
|
|
191
206
|
rpc RespondActivityTaskCanceledById (RespondActivityTaskCanceledByIdRequest) returns (RespondActivityTaskCanceledByIdResponse) {
|
|
192
207
|
}
|
|
193
208
|
|
|
194
|
-
// RequestCancelWorkflowExecution is called by
|
|
195
|
-
//
|
|
196
|
-
//
|
|
197
|
-
//
|
|
209
|
+
// RequestCancelWorkflowExecution is called by workers when they want to request cancellation of
|
|
210
|
+
// a workflow execution.
|
|
211
|
+
//
|
|
212
|
+
// This result in a new `WORKFLOW_EXECUTION_CANCEL_REQUESTED` event being written to the
|
|
213
|
+
// workflow history and a new workflow task created for the workflow. Fails with `NotFound` if
|
|
214
|
+
// the workflow is already completed or doesn't exist.
|
|
198
215
|
rpc RequestCancelWorkflowExecution (RequestCancelWorkflowExecutionRequest) returns (RequestCancelWorkflowExecutionResponse) {
|
|
199
216
|
}
|
|
200
217
|
|
|
201
|
-
// SignalWorkflowExecution is used to send a signal
|
|
202
|
-
//
|
|
218
|
+
// SignalWorkflowExecution is used to send a signal to a running workflow execution.
|
|
219
|
+
//
|
|
220
|
+
// This results in a `WORKFLOW_EXECUTION_SIGNALED` event recorded in the history and a workflow
|
|
221
|
+
// task being created for the execution.
|
|
203
222
|
rpc SignalWorkflowExecution (SignalWorkflowExecutionRequest) returns (SignalWorkflowExecutionResponse) {
|
|
204
223
|
}
|
|
205
224
|
|
|
225
|
+
// SignalWithStartWorkflowExecution is used to ensure a signal is sent to a workflow, even if
|
|
226
|
+
// it isn't yet started.
|
|
227
|
+
//
|
|
228
|
+
// If the workflow is running, a `WORKFLOW_EXECUTION_SIGNALED` event is recorded in the history
|
|
229
|
+
// and a workflow task is generated.
|
|
230
|
+
//
|
|
231
|
+
// If the workflow is not running or not found, then the workflow is created with
|
|
232
|
+
// `WORKFLOW_EXECUTION_STARTED` and `WORKFLOW_EXECUTION_SIGNALED` events in its history, and a
|
|
233
|
+
// workflow task is generated.
|
|
234
|
+
//
|
|
206
235
|
// (-- api-linter: core::0136::prepositions=disabled
|
|
207
236
|
// aip.dev/not-precedent: "With" is used to indicate combined operation. --)
|
|
208
|
-
// SignalWithStartWorkflowExecution is used to ensure sending signal to a workflow.
|
|
209
|
-
// If the workflow is running, this results in WorkflowExecutionSignaled event being recorded in the history
|
|
210
|
-
// and a workflow task being created for the execution.
|
|
211
|
-
// If the workflow is not running or not found, this results in WorkflowExecutionStarted and WorkflowExecutionSignaled
|
|
212
|
-
// events being recorded in history, and a workflow task being created for the execution
|
|
213
237
|
rpc SignalWithStartWorkflowExecution (SignalWithStartWorkflowExecutionRequest) returns (SignalWithStartWorkflowExecutionResponse) {
|
|
214
238
|
}
|
|
215
239
|
|
|
216
|
-
// ResetWorkflowExecution reset an existing workflow execution to
|
|
217
|
-
//
|
|
240
|
+
// ResetWorkflowExecution will reset an existing workflow execution to a specified
|
|
241
|
+
// `WORKFLOW_TASK_COMPLETED` event (exclusive). It will immediately terminate the current
|
|
242
|
+
// execution instance.
|
|
243
|
+
// TODO: Does exclusive here mean *just* the completed event, or also WFT started? Otherwise the task is doomed to time out?
|
|
218
244
|
rpc ResetWorkflowExecution (ResetWorkflowExecutionRequest) returns (ResetWorkflowExecutionResponse) {
|
|
219
245
|
}
|
|
220
246
|
|
|
221
|
-
// TerminateWorkflowExecution terminates an existing workflow execution by recording
|
|
222
|
-
// in the history and immediately terminating the
|
|
247
|
+
// TerminateWorkflowExecution terminates an existing workflow execution by recording a
|
|
248
|
+
// `WORKFLOW_EXECUTION_TERMINATED` event in the history and immediately terminating the
|
|
249
|
+
// execution instance.
|
|
223
250
|
rpc TerminateWorkflowExecution (TerminateWorkflowExecutionRequest) returns (TerminateWorkflowExecutionResponse) {
|
|
224
251
|
}
|
|
225
252
|
|
|
@@ -251,20 +278,25 @@ service WorkflowService {
|
|
|
251
278
|
rpc GetSearchAttributes (GetSearchAttributesRequest) returns (GetSearchAttributesResponse) {
|
|
252
279
|
}
|
|
253
280
|
|
|
254
|
-
// RespondQueryTaskCompleted is called by
|
|
255
|
-
//
|
|
256
|
-
//
|
|
281
|
+
// RespondQueryTaskCompleted is called by workers to complete queries which were delivered on
|
|
282
|
+
// the `query` (not `queries`) field of a `PollWorkflowTaskQueueResponse`.
|
|
283
|
+
//
|
|
284
|
+
// Completing the query will unblock the corresponding client call to `QueryWorkflow` and return
|
|
285
|
+
// the query result a response.
|
|
257
286
|
rpc RespondQueryTaskCompleted (RespondQueryTaskCompletedRequest) returns (RespondQueryTaskCompletedResponse) {
|
|
258
287
|
}
|
|
259
288
|
|
|
260
|
-
// ResetStickyTaskQueue resets the sticky task queue related information in mutable state of
|
|
289
|
+
// ResetStickyTaskQueue resets the sticky task queue related information in the mutable state of
|
|
290
|
+
// a given workflow. This is prudent for workers to perform if a workflow has been paged out of
|
|
291
|
+
// their cache.
|
|
292
|
+
//
|
|
261
293
|
// Things cleared are:
|
|
262
294
|
// 1. StickyTaskQueue
|
|
263
295
|
// 2. StickyScheduleToStartTimeout
|
|
264
296
|
rpc ResetStickyTaskQueue (ResetStickyTaskQueueRequest) returns (ResetStickyTaskQueueResponse) {
|
|
265
297
|
}
|
|
266
298
|
|
|
267
|
-
// QueryWorkflow
|
|
299
|
+
// QueryWorkflow requests a query be executed for a specified workflow execution.
|
|
268
300
|
rpc QueryWorkflow (QueryWorkflowRequest) returns (QueryWorkflowResponse) {
|
|
269
301
|
}
|
|
270
302
|
|
|
@@ -272,8 +304,7 @@ service WorkflowService {
|
|
|
272
304
|
rpc DescribeWorkflowExecution (DescribeWorkflowExecutionRequest) returns (DescribeWorkflowExecutionResponse) {
|
|
273
305
|
}
|
|
274
306
|
|
|
275
|
-
// DescribeTaskQueue returns information about the target task queue
|
|
276
|
-
// pollers which polled this task queue in last few minutes.
|
|
307
|
+
// DescribeTaskQueue returns information about the target task queue.
|
|
277
308
|
rpc DescribeTaskQueue (DescribeTaskQueueRequest) returns (DescribeTaskQueueResponse) {
|
|
278
309
|
}
|
|
279
310
|
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package coresdk.activity_result;
|
|
4
|
+
|
|
5
|
+
import "google/protobuf/duration.proto";
|
|
6
|
+
import "google/protobuf/timestamp.proto";
|
|
7
|
+
import "temporal/api/failure/v1/message.proto";
|
|
8
|
+
import "temporal/sdk/core/common/common.proto";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Used to report activity completions to core
|
|
12
|
+
*/
|
|
13
|
+
message ActivityExecutionResult {
|
|
14
|
+
oneof status {
|
|
15
|
+
Success completed = 1;
|
|
16
|
+
Failure failed = 2;
|
|
17
|
+
Cancellation cancelled = 3;
|
|
18
|
+
WillCompleteAsync will_complete_async = 4;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Used to report activity resolutions to lang. IE: This is what the activities are resolved with
|
|
23
|
+
// in the workflow.
|
|
24
|
+
message ActivityResolution {
|
|
25
|
+
oneof status {
|
|
26
|
+
Success completed = 1;
|
|
27
|
+
Failure failed = 2;
|
|
28
|
+
Cancellation cancelled = 3;
|
|
29
|
+
DoBackoff backoff = 4;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Used to report successful completion either when executing or resolving */
|
|
34
|
+
message Success {
|
|
35
|
+
common.Payload result = 1;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Used to report activity failure either when executing or resolving */
|
|
39
|
+
message Failure {
|
|
40
|
+
temporal.api.failure.v1.Failure failure = 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Used to report cancellation from both Core and Lang.
|
|
45
|
+
* When Lang reports a cancelled activity, it must put a CancelledFailure in the failure field.
|
|
46
|
+
* When Core reports a cancelled activity, it must put an ActivityFailure with CancelledFailure
|
|
47
|
+
* as the cause in the failure field.
|
|
48
|
+
*/
|
|
49
|
+
message Cancellation {
|
|
50
|
+
temporal.api.failure.v1.Failure failure = 1;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Used in ActivityExecutionResult to notify Core that this Activity will complete asynchronously.
|
|
55
|
+
* Core will forget about this Activity and free up resources used to track this Activity.
|
|
56
|
+
*/
|
|
57
|
+
message WillCompleteAsync {
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Issued when a local activity needs to retry but also wants to back off more than would be
|
|
62
|
+
* reasonable to WFT heartbeat for. Lang is expected to schedule a timer for the duration
|
|
63
|
+
* and then start a local activity of the same type & same inputs with the provided attempt number
|
|
64
|
+
* after the timer has elapsed.
|
|
65
|
+
*
|
|
66
|
+
* This exists because Core does not have a concept of starting commands by itself, they originate
|
|
67
|
+
* from lang. So expecting lang to start the timer / next pass of the activity fits more smoothly.
|
|
68
|
+
*/
|
|
69
|
+
message DoBackoff {
|
|
70
|
+
// The attempt number that lang should provide when scheduling the retry. If the LA failed
|
|
71
|
+
// on attempt 4 and we told lang to back off with a timer, this number will be 5.
|
|
72
|
+
uint32 attempt = 1;
|
|
73
|
+
google.protobuf.Duration backoff_duration = 2;
|
|
74
|
+
// The time the first attempt of this local activity was scheduled. Must be passed with attempt
|
|
75
|
+
// to the retry LA.
|
|
76
|
+
google.protobuf.Timestamp original_schedule_time = 3;
|
|
77
|
+
}
|
|
78
|
+
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Definitions of the different activity tasks returned from [crate::Core::poll_task].
|
|
5
|
+
*/
|
|
6
|
+
package coresdk.activity_task;
|
|
7
|
+
|
|
8
|
+
import "google/protobuf/duration.proto";
|
|
9
|
+
import "google/protobuf/timestamp.proto";
|
|
10
|
+
import "temporal/sdk/core/common/common.proto";
|
|
11
|
+
|
|
12
|
+
message ActivityTask {
|
|
13
|
+
/// A unique identifier for this task
|
|
14
|
+
bytes task_token = 1;
|
|
15
|
+
oneof variant {
|
|
16
|
+
/// Start activity execution.
|
|
17
|
+
Start start = 3;
|
|
18
|
+
/// Attempt to cancel activity execution.
|
|
19
|
+
Cancel cancel = 4;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Begin executing an activity
|
|
24
|
+
message Start {
|
|
25
|
+
// The namespace the workflow lives in
|
|
26
|
+
string workflow_namespace = 1;
|
|
27
|
+
// The workflow's type name or function identifier
|
|
28
|
+
string workflow_type = 2;
|
|
29
|
+
// The workflow execution which requested this activity
|
|
30
|
+
common.WorkflowExecution workflow_execution = 3;
|
|
31
|
+
// The activity's ID
|
|
32
|
+
string activity_id = 4;
|
|
33
|
+
// The activity's type name or function identifier
|
|
34
|
+
string activity_type = 5;
|
|
35
|
+
map<string, common.Payload> header_fields = 6;
|
|
36
|
+
// Arguments to the activity
|
|
37
|
+
repeated common.Payload input = 7;
|
|
38
|
+
// The last details that were recorded by a heartbeat when this task was generated
|
|
39
|
+
repeated common.Payload heartbeat_details = 8;
|
|
40
|
+
// When the task was *first* scheduled
|
|
41
|
+
google.protobuf.Timestamp scheduled_time = 9;
|
|
42
|
+
// When this current attempt at the task was scheduled
|
|
43
|
+
google.protobuf.Timestamp current_attempt_scheduled_time = 10;
|
|
44
|
+
// When this attempt was started, which is to say when core received it by polling.
|
|
45
|
+
google.protobuf.Timestamp started_time = 11;
|
|
46
|
+
uint32 attempt = 12;
|
|
47
|
+
|
|
48
|
+
// Timeout from the first schedule time to completion
|
|
49
|
+
google.protobuf.Duration schedule_to_close_timeout = 13;
|
|
50
|
+
// Timeout from starting an attempt to reporting its result
|
|
51
|
+
google.protobuf.Duration start_to_close_timeout = 14;
|
|
52
|
+
// If set a heartbeat must be reported within this interval
|
|
53
|
+
google.protobuf.Duration heartbeat_timeout = 15;
|
|
54
|
+
// This is an actual retry policy the service uses. It can be different from the one provided
|
|
55
|
+
// (or not) during activity scheduling as the service can override the provided one in case its
|
|
56
|
+
// values are not specified or exceed configured system limits.
|
|
57
|
+
common.RetryPolicy retry_policy = 16;
|
|
58
|
+
|
|
59
|
+
// Set to true if this is a local activity. Note that heartbeating does not apply to local
|
|
60
|
+
// activities.
|
|
61
|
+
bool is_local = 17;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/// Attempt to cancel a running activity
|
|
65
|
+
message Cancel {
|
|
66
|
+
ActivityCancelReason reason = 1;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
enum ActivityCancelReason {
|
|
70
|
+
/// The activity no longer exists according to server (may be already completed)
|
|
71
|
+
NOT_FOUND = 0;
|
|
72
|
+
/// Activity was explicitly cancelled
|
|
73
|
+
CANCELLED = 1;
|
|
74
|
+
/// Activity timed out
|
|
75
|
+
TIMED_OUT = 2;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|