Skip to content

Commit

Permalink
New event: update requested (#351)
Browse files Browse the repository at this point in the history
Add new event EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_REQUESTED for update reapply.
  • Loading branch information
dandavison authored Jan 29, 2024
1 parent 3db0659 commit 1dcc8e1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions temporal/api/enums/v1/event_type.proto
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,8 @@ enum EventType {
EVENT_TYPE_ACTIVITY_PROPERTIES_MODIFIED_EXTERNALLY = 45;
// Workflow properties modified by user workflow code
EVENT_TYPE_WORKFLOW_PROPERTIES_MODIFIED = 46;
// An update was requested. Note that not all update requests result in this
// event. See UpdateRequestedEventOrigin for situations in which this event
// is created.
EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_REQUESTED = 47;
}
2 changes: 2 additions & 0 deletions temporal/api/enums/v1/reset.proto
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ enum ResetReapplyExcludeType {
RESET_REAPPLY_EXCLUDE_TYPE_UNSPECIFIED = 0;
// Exclude signals when reapplying events.
RESET_REAPPLY_EXCLUDE_TYPE_SIGNAL = 1;
// Exclude updates when reapplying events.
RESET_REAPPLY_EXCLUDE_TYPE_UPDATE = 2;
}

// Event types to include when reapplying events. Deprecated: applications
Expand Down
10 changes: 10 additions & 0 deletions temporal/api/enums/v1/update.proto
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,13 @@ enum UpdateWorkflowExecutionLifecycleStage {
// on a worker and has either been rejected or returned a value or an error.
UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_COMPLETED = 3;
}

// Records why a WorkflowExecutionUpdateRequestedEvent was written to history.
// Note that not all update requests result in this event.
enum UpdateRequestedEventOrigin {
UPDATE_REQUESTED_EVENT_ORIGIN_UNSPECIFIED = 0;
// The UpdateRequested event was created when reapplying events during reset
// or replication. I.e. an accepted update on one branch of workflow history
// was converted into a requested update on a different branch.
UPDATE_REQUESTED_EVENT_ORIGIN_REAPPLY = 1;
}
8 changes: 8 additions & 0 deletions temporal/api/history/v1/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import "google/protobuf/timestamp.proto";

import "temporal/api/enums/v1/event_type.proto";
import "temporal/api/enums/v1/failed_cause.proto";
import "temporal/api/enums/v1/update.proto";
import "temporal/api/enums/v1/workflow.proto";
import "temporal/api/common/v1/message.proto";
import "temporal/api/failure/v1/message.proto";
Expand Down Expand Up @@ -749,6 +750,12 @@ message WorkflowExecutionUpdateRejectedEventAttributes {
temporal.api.failure.v1.Failure failure = 5;
}

message WorkflowExecutionUpdateRequestedEventAttributes {
// The update request associated with this event.
temporal.api.update.v1.Request request = 1;
// An explanation of why this event was written to history.
temporal.api.enums.v1.UpdateRequestedEventOrigin origin = 2;
}

// History events are the method by which Temporal SDKs advance (or recreate) workflow state.
// See the `EventType` enum for more info about what each event is for.
Expand Down Expand Up @@ -814,6 +821,7 @@ message HistoryEvent {
WorkflowPropertiesModifiedExternallyEventAttributes workflow_properties_modified_externally_event_attributes = 49;
ActivityPropertiesModifiedExternallyEventAttributes activity_properties_modified_externally_event_attributes = 50;
WorkflowPropertiesModifiedEventAttributes workflow_properties_modified_event_attributes = 51;
WorkflowExecutionUpdateRequestedEventAttributes workflow_execution_update_requested_event_attributes = 52;
}
}

Expand Down

0 comments on commit 1dcc8e1

Please sign in to comment.