feat: Add compensation workflow pattern to Spring Boot examples#1696
Open
siri-varma wants to merge 2 commits intodapr:masterfrom
Open
feat: Add compensation workflow pattern to Spring Boot examples#1696siri-varma wants to merge 2 commits intodapr:masterfrom
siri-varma wants to merge 2 commits intodapr:masterfrom
Conversation
Port the BookTrip compensation (Saga) workflow from the plain Java examples into the Spring Boot workflow patterns module, adding @Component-annotated activities and a /wfp/compensation REST endpoint. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Siri Varma Vegiraju <svegiraju@Siris-MacBook-Pro.local>
There was a problem hiding this comment.
Pull request overview
Adds a Spring Boot “compensation / Saga” workflow pattern example (BookTrip) to the workflows/patterns module, along with a REST endpoint to trigger it.
Changes:
- Introduces
BookTripWorkflowimplementing a simple saga with compensating activities. - Adds booking and cancellation workflow activities as Spring components.
- Exposes a new
POST /wfp/compensationendpoint to run the workflow and return its output.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| spring-boot-examples/workflows/patterns/src/main/java/io/dapr/springboot/examples/wfp/compensation/CancelHotelActivity.java | Adds hotel-cancellation activity for compensation flow |
| spring-boot-examples/workflows/patterns/src/main/java/io/dapr/springboot/examples/wfp/compensation/CancelFlightActivity.java | Adds flight-cancellation activity for compensation flow |
| spring-boot-examples/workflows/patterns/src/main/java/io/dapr/springboot/examples/wfp/compensation/CancelCarActivity.java | Adds car-cancellation activity for compensation flow |
| spring-boot-examples/workflows/patterns/src/main/java/io/dapr/springboot/examples/wfp/compensation/BookTripWorkflow.java | Implements saga-style orchestration with compensation retries |
| spring-boot-examples/workflows/patterns/src/main/java/io/dapr/springboot/examples/wfp/compensation/BookHotelActivity.java | Adds hotel booking activity used by the workflow |
| spring-boot-examples/workflows/patterns/src/main/java/io/dapr/springboot/examples/wfp/compensation/BookFlightActivity.java | Adds flight booking activity used by the workflow |
| spring-boot-examples/workflows/patterns/src/main/java/io/dapr/springboot/examples/wfp/compensation/BookCarActivity.java | Adds car booking activity that intentionally fails to trigger compensation |
| spring-boot-examples/workflows/patterns/src/main/java/io/dapr/springboot/examples/wfp/WorkflowPatternsRestController.java | Adds POST /wfp/compensation endpoint to run the new workflow |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...s/patterns/src/main/java/io/dapr/springboot/examples/wfp/compensation/BookHotelActivity.java
Show resolved
Hide resolved
...ows/patterns/src/main/java/io/dapr/springboot/examples/wfp/compensation/BookCarActivity.java
Show resolved
Hide resolved
...atterns/src/main/java/io/dapr/springboot/examples/wfp/compensation/CancelFlightActivity.java
Show resolved
Hide resolved
...patterns/src/main/java/io/dapr/springboot/examples/wfp/compensation/CancelHotelActivity.java
Show resolved
Hide resolved
...ws/patterns/src/main/java/io/dapr/springboot/examples/wfp/compensation/BookTripWorkflow.java
Show resolved
Hide resolved
...ws/patterns/src/main/java/io/dapr/springboot/examples/wfp/compensation/BookTripWorkflow.java
Show resolved
Hide resolved
...s/patterns/src/main/java/io/dapr/springboot/examples/wfp/WorkflowPatternsRestController.java
Show resolved
Hide resolved
.../patterns/src/main/java/io/dapr/springboot/examples/wfp/compensation/BookFlightActivity.java
Show resolved
Hide resolved
...s/patterns/src/main/java/io/dapr/springboot/examples/wfp/compensation/CancelCarActivity.java
Show resolved
Hide resolved
...ws/patterns/src/main/java/io/dapr/springboot/examples/wfp/compensation/BookTripWorkflow.java
Show resolved
Hide resolved
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1696 +/- ##
=========================================
Coverage 79.53% 79.53%
Complexity 2193 2193
=========================================
Files 237 237
Lines 6577 6577
Branches 730 730
=========================================
Hits 5231 5231
Misses 990 990
Partials 356 356 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Port the BookTrip compensation (Saga) workflow from the plain Java examples into the Spring Boot workflow patterns module, adding @Component-annotated activities and a /wfp/compensation REST endpoint.
Description
Please explain the changes you've made
Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #1395
#1395
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: