-
Notifications
You must be signed in to change notification settings - Fork 227
Add support for workflow history propagation #1739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
siri-varma
wants to merge
20
commits into
dapr:master
Choose a base branch
from
siri-varma:users/svegiraju/implement-workflow-2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
75aa686
Apply suggestions from code review
siri-varma 1e4c6ed
Refactor BookTripWorkflow to use CompensationHelper
siri-varma 07adaeb
Add CompensationHelper class for managing compensations
siri-varma 2b4beef
Await cancellation activities in BookTripWorkflow
siri-varma df4742b
Add the new changes
siri-varma 61896d2
fix violations
siri-varma 22fb2e9
Fix helper
siri-varma c6f64db
Modify readme
siri-varma 703c3ac
Modify readme
siri-varma f736ee9
Modify readme
siri-varma f594969
Update copyright year and improve comment clarity
siri-varma 7a66eae
Update copyright year to 2026
siri-varma d2c7904
Update HistoryPropagationScope.java
siri-varma 18b3189
Update ActivityHistoryPropagationTest.java
siri-varma da80d3f
Change to 2026
siri-varma 04637e3
Fix things
siri-varma 1f000f8
Potential fix for pull request finding
siri-varma 8ac5df3
Hide chunk concept; expose WorkflowResult with typed lookups
siri-varma 524a5b8
Bump copyright year to 2026 on PR files
siri-varma 32328de
Surface PropagatedHistoryException at parse boundaries
siri-varma File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
115 changes: 115 additions & 0 deletions
115
durabletask-client/src/main/java/io/dapr/durabletask/ActivityResult.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| /* | ||
| * Copyright 2026 The Dapr Authors | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package io.dapr.durabletask; | ||
|
|
||
| import com.google.protobuf.StringValue; | ||
| import io.dapr.durabletask.implementation.protobuf.Orchestration.TaskFailureDetails; | ||
|
|
||
| /** | ||
| * Holds the status and data of a named activity invocation observed in | ||
| * propagated workflow history. An activity is reported as {@code started} | ||
| * once it was scheduled; {@code completed} or {@code failed} reflect the | ||
| * terminal state of that scheduling. | ||
| */ | ||
| public final class ActivityResult { | ||
| private final String name; | ||
| private final boolean started; | ||
| private final boolean completed; | ||
| private final boolean failed; | ||
| private final StringValue input; | ||
| private final StringValue output; | ||
| private final TaskFailureDetails error; | ||
|
|
||
| ActivityResult(String name, | ||
| boolean started, | ||
| boolean completed, | ||
| boolean failed, | ||
| StringValue input, | ||
| StringValue output, | ||
| TaskFailureDetails error) { | ||
| this.name = name; | ||
| this.started = started; | ||
| this.completed = completed; | ||
| this.failed = failed; | ||
| this.input = input; | ||
| this.output = output; | ||
| this.error = error; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the activity name. | ||
| * | ||
| * @return the activity name | ||
| */ | ||
| public String getName() { | ||
| return this.name; | ||
| } | ||
|
|
||
| /** | ||
| * Returns true if the activity was scheduled. | ||
| * | ||
| * @return whether the activity started | ||
| */ | ||
| public boolean isStarted() { | ||
| return this.started; | ||
| } | ||
|
|
||
| /** | ||
| * Returns true if the activity completed successfully. | ||
| * | ||
| * @return whether the activity completed | ||
| */ | ||
| public boolean isCompleted() { | ||
| return this.completed; | ||
| } | ||
|
|
||
| /** | ||
| * Returns true if the activity failed. | ||
| * | ||
| * @return whether the activity failed | ||
| */ | ||
| public boolean isFailed() { | ||
| return this.failed; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the activity input as recorded in the scheduling event, or null if | ||
| * no input was provided. | ||
| * | ||
| * @return the input wrapper, or null | ||
| */ | ||
| public StringValue getInput() { | ||
| return this.input; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the activity output from the matching completion event, or null if | ||
| * the activity has not completed successfully. | ||
| * | ||
| * @return the output wrapper, or null | ||
| */ | ||
| public StringValue getOutput() { | ||
| return this.output; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the failure details from the matching failure event, or null if the | ||
| * activity has not failed. | ||
| * | ||
| * @return the failure details, or null | ||
| */ | ||
| public TaskFailureDetails getError() { | ||
| return this.error; | ||
| } | ||
| } | ||
100 changes: 100 additions & 0 deletions
100
durabletask-client/src/main/java/io/dapr/durabletask/ChildWorkflowResult.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| /* | ||
| * Copyright 2026 The Dapr Authors | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package io.dapr.durabletask; | ||
|
|
||
| import com.google.protobuf.StringValue; | ||
| import io.dapr.durabletask.implementation.protobuf.Orchestration.TaskFailureDetails; | ||
|
|
||
| /** | ||
| * Holds the status and data of a named child workflow invocation observed in | ||
| * propagated workflow history. | ||
| */ | ||
| public final class ChildWorkflowResult { | ||
| private final String name; | ||
| private final boolean started; | ||
| private final boolean completed; | ||
| private final boolean failed; | ||
| private final StringValue output; | ||
| private final TaskFailureDetails error; | ||
|
|
||
| ChildWorkflowResult(String name, | ||
| boolean started, | ||
| boolean completed, | ||
| boolean failed, | ||
| StringValue output, | ||
| TaskFailureDetails error) { | ||
| this.name = name; | ||
| this.started = started; | ||
| this.completed = completed; | ||
| this.failed = failed; | ||
| this.output = output; | ||
| this.error = error; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the child workflow name. | ||
| * | ||
| * @return the child workflow name | ||
| */ | ||
| public String getName() { | ||
| return this.name; | ||
| } | ||
|
|
||
| /** | ||
| * Returns true if the child workflow was scheduled. | ||
| * | ||
| * @return whether the child workflow started | ||
| */ | ||
| public boolean isStarted() { | ||
| return this.started; | ||
| } | ||
|
|
||
| /** | ||
| * Returns true if the child workflow completed successfully. | ||
| * | ||
| * @return whether the child workflow completed | ||
| */ | ||
| public boolean isCompleted() { | ||
| return this.completed; | ||
| } | ||
|
|
||
| /** | ||
| * Returns true if the child workflow failed. | ||
| * | ||
| * @return whether the child workflow failed | ||
| */ | ||
| public boolean isFailed() { | ||
| return this.failed; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the child workflow output from the matching completion event, or | ||
| * null if the child workflow has not completed successfully. | ||
| * | ||
| * @return the output wrapper, or null | ||
| */ | ||
| public StringValue getOutput() { | ||
| return this.output; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the failure details from the matching failure event, or null if the | ||
| * child workflow has not failed. | ||
| * | ||
| * @return the failure details, or null | ||
| */ | ||
| public TaskFailureDetails getError() { | ||
| return this.error; | ||
| } | ||
| } |
60 changes: 60 additions & 0 deletions
60
durabletask-client/src/main/java/io/dapr/durabletask/HistoryPropagationScope.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| /* | ||
| * Copyright 2026 The Dapr Authors | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package io.dapr.durabletask; | ||
|
|
||
| import io.dapr.durabletask.implementation.protobuf.Orchestration; | ||
|
|
||
| /** | ||
| * Controls how execution history is propagated to a child workflow or activity. | ||
| */ | ||
| public enum HistoryPropagationScope { | ||
| /** | ||
| * No propagation. The child receives no history from the caller. | ||
| */ | ||
| NONE, | ||
|
|
||
| /** | ||
| * Propagate the caller's own history events only. The child does not see | ||
| * any ancestral history (trust boundary). | ||
| */ | ||
| OWN_HISTORY, | ||
|
|
||
| /** | ||
| * Propagate the caller's own history events AND the full ancestral chain. | ||
| * Any propagated history this workflow received from its parent is forwarded to the child. | ||
| */ | ||
| LINEAGE; | ||
|
|
||
| Orchestration.HistoryPropagationScope toProto() { | ||
| switch (this) { | ||
| case OWN_HISTORY: | ||
| return Orchestration.HistoryPropagationScope.HISTORY_PROPAGATION_SCOPE_OWN_HISTORY; | ||
| case LINEAGE: | ||
| return Orchestration.HistoryPropagationScope.HISTORY_PROPAGATION_SCOPE_LINEAGE; | ||
| default: | ||
| return Orchestration.HistoryPropagationScope.HISTORY_PROPAGATION_SCOPE_NONE; | ||
| } | ||
| } | ||
|
|
||
| static HistoryPropagationScope fromProto(Orchestration.HistoryPropagationScope proto) { | ||
| switch (proto) { | ||
| case HISTORY_PROPAGATION_SCOPE_OWN_HISTORY: | ||
| return OWN_HISTORY; | ||
| case HISTORY_PROPAGATION_SCOPE_LINEAGE: | ||
| return LINEAGE; | ||
| default: | ||
| return NONE; | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This field is always true, do we have a use case where this can be false? Same for ChildWorkflowResult