Skip to content

Commit 9d467d6

Browse files
committed
refactor: extract NewActivityExecutionInfo and remove completion_callbacks
Move ScheduleActivityAction fields into NewActivityExecutionInfo in activity/v1/message.proto, mirroring NewWorkflowExecutionInfo pattern. Reference it from ScheduleAction oneof. Remove completion_callbacks from StartActivityExecutionRequest.
1 parent 312c592 commit 9d467d6

3 files changed

Lines changed: 61 additions & 56 deletions

File tree

‎temporal/api/activity/v1/message.proto‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,63 @@ message ActivityExecutionInfo {
163163
string canceled_reason = 32;
164164
}
165165

166+
// NewActivityExecutionInfo is a shared message that encapsulates all the
167+
// required arguments to starting a standalone activity in different contexts.
168+
message NewActivityExecutionInfo {
169+
// Identifier for this activity. Must be unique among activities in the same namespace.
170+
string activity_id = 1;
171+
172+
// The type of the activity to execute.
173+
temporal.api.common.v1.ActivityType activity_type = 2;
174+
175+
// Task queue to schedule the activity on.
176+
temporal.api.taskqueue.v1.TaskQueue task_queue = 3;
177+
178+
// Serialized arguments to the activity.
179+
temporal.api.common.v1.Payloads input = 4;
180+
181+
// Indicates how long the caller is willing to wait for an activity completion. Limits how long
182+
// retries will be attempted. Either this or `start_to_close_timeout` must be specified.
183+
//
184+
// (-- api-linter: core::0140::prepositions=disabled
185+
// aip.dev/not-precedent: "to" is used to indicate interval. --)
186+
google.protobuf.Duration schedule_to_close_timeout = 5;
187+
188+
// Limits time an activity task can stay in a task queue before a worker picks it up. This
189+
// timeout is always non retryable, as all a retry would achieve is to put it back into the same
190+
// queue. Defaults to `schedule_to_close_timeout` if not specified.
191+
//
192+
// (-- api-linter: core::0140::prepositions=disabled
193+
// aip.dev/not-precedent: "to" is used to indicate interval. --)
194+
google.protobuf.Duration schedule_to_start_timeout = 6;
195+
196+
// Maximum time an activity is allowed to execute after being picked up by a worker. This
197+
// timeout is always retryable. Either this or `schedule_to_close_timeout` must be
198+
// specified.
199+
//
200+
// (-- api-linter: core::0140::prepositions=disabled
201+
// aip.dev/not-precedent: "to" is used to indicate interval. --)
202+
google.protobuf.Duration start_to_close_timeout = 7;
203+
204+
// Maximum permitted time between successful worker heartbeats.
205+
google.protobuf.Duration heartbeat_timeout = 8;
206+
207+
// The retry policy for the activity. Will never exceed `schedule_to_close_timeout`.
208+
temporal.api.common.v1.RetryPolicy retry_policy = 9;
209+
210+
// Header for context propagation and tracing purposes.
211+
temporal.api.common.v1.Header header = 10;
212+
213+
// Search attributes for indexing.
214+
temporal.api.common.v1.SearchAttributes search_attributes = 11;
215+
216+
// Metadata for use by user interfaces to display the fixed as-of-start summary and details of the activity.
217+
temporal.api.sdk.v1.UserMetadata user_metadata = 12;
218+
219+
// Priority metadata.
220+
temporal.api.common.v1.Priority priority = 13;
221+
}
222+
166223
// Limited activity information returned in the list response.
167224
// When adding fields here, ensure that it is also present in ActivityExecutionInfo (note that it
168225
// may already be present in ActivityExecutionInfo but not at the top-level).

‎temporal/api/schedule/v1/message.proto‎

Lines changed: 4 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ option csharp_namespace = "Temporalio.Api.Schedule.V1";
1717
import "google/protobuf/duration.proto";
1818
import "google/protobuf/timestamp.proto";
1919

20+
import "temporal/api/activity/v1/message.proto";
2021
import "temporal/api/common/v1/message.proto";
2122
import "temporal/api/enums/v1/schedule.proto";
2223
import "temporal/api/enums/v1/workflow.proto";
23-
import "temporal/api/sdk/v1/user_metadata.proto";
24-
import "temporal/api/taskqueue/v1/message.proto";
2524
import "temporal/api/workflow/v1/message.proto";
2625

2726
// CalendarSpec describes an event specification relative to the calendar,
@@ -231,54 +230,6 @@ message SchedulePolicies {
231230
bool keep_original_workflow_id = 4;
232231
}
233232

234-
// ScheduleActivityAction describes a standalone activity to start on each schedule trigger.
235-
message ScheduleActivityAction {
236-
// The activity ID. May have a timestamp appended for uniqueness.
237-
string activity_id = 1;
238-
239-
// The type of the activity to execute.
240-
temporal.api.common.v1.ActivityType activity_type = 2;
241-
242-
// Task queue to schedule the activity on.
243-
temporal.api.taskqueue.v1.TaskQueue task_queue = 3;
244-
245-
// Serialized arguments to the activity.
246-
temporal.api.common.v1.Payloads input = 4;
247-
248-
// Timeout from schedule to close of the activity.
249-
// (-- api-linter: core::0140::prepositions=disabled
250-
// aip.dev/not-precedent: standard name of field --)
251-
google.protobuf.Duration schedule_to_close_timeout = 5;
252-
253-
// Timeout from schedule to start of the activity.
254-
// (-- api-linter: core::0140::prepositions=disabled
255-
// aip.dev/not-precedent: standard name of field --)
256-
google.protobuf.Duration schedule_to_start_timeout = 6;
257-
258-
// Timeout from start to close of the activity.
259-
// (-- api-linter: core::0140::prepositions=disabled
260-
// aip.dev/not-precedent: standard name of field --)
261-
google.protobuf.Duration start_to_close_timeout = 7;
262-
263-
// Heartbeat timeout.
264-
google.protobuf.Duration heartbeat_timeout = 8;
265-
266-
// Retry policy for the activity.
267-
temporal.api.common.v1.RetryPolicy retry_policy = 9;
268-
269-
// Request header for context propagation.
270-
temporal.api.common.v1.Header header = 10;
271-
272-
// Search attributes for the activity.
273-
temporal.api.common.v1.SearchAttributes search_attributes = 11;
274-
275-
// Metadata for display purposes.
276-
temporal.api.sdk.v1.UserMetadata user_metadata = 12;
277-
278-
// Priority metadata.
279-
temporal.api.common.v1.Priority priority = 13;
280-
}
281-
282233
message ScheduleAction {
283234
oneof action {
284235
// All fields of NewWorkflowExecutionInfo are valid except for:
@@ -288,10 +239,11 @@ message ScheduleAction {
288239
// it may have a timestamp appended for uniqueness.
289240
temporal.api.workflow.v1.NewWorkflowExecutionInfo start_workflow = 1;
290241

291-
// Start a standalone activity execution.
242+
// All fields of NewActivityExecutionInfo are valid except for:
243+
// - activity_id (will be set by the server)
292244
// The activity id of the started activity may not match this exactly,
293245
// it may have a timestamp appended for uniqueness.
294-
ScheduleActivityAction start_activity = 2;
246+
temporal.api.activity.v1.NewActivityExecutionInfo start_activity = 2;
295247
}
296248
}
297249

‎temporal/api/workflowservice/v1/request_response.proto‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2931,10 +2931,6 @@ message StartActivityExecutionRequest {
29312931
temporal.api.sdk.v1.UserMetadata user_metadata = 17;
29322932
// Priority metadata.
29332933
temporal.api.common.v1.Priority priority = 18;
2934-
2935-
// Callbacks to invoke on activity completion.
2936-
// Used internally by the scheduler to track activity lifecycle.
2937-
repeated temporal.api.common.v1.Callback completion_callbacks = 19;
29382934
}
29392935

29402936
message StartActivityExecutionResponse {

0 commit comments

Comments
 (0)