Skip to content

feat: Add compensation workflow pattern to Spring Boot examples#1696

Open
siri-varma wants to merge 2 commits intodapr:masterfrom
siri-varma:master
Open

feat: Add compensation workflow pattern to Spring Boot examples#1696
siri-varma wants to merge 2 commits intodapr:masterfrom
siri-varma:master

Conversation

@siri-varma
Copy link
Contributor

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:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

@siri-varma siri-varma marked this pull request as ready for review March 13, 2026 21:56
@siri-varma siri-varma requested review from a team as code owners March 13, 2026 21:56
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>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 BookTripWorkflow implementing a simple saga with compensating activities.
  • Adds booking and cancellation workflow activities as Spring components.
  • Exposes a new POST /wfp/compensation endpoint 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.

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
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.53%. Comparing base (f63a4a4) to head (80d09f8).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SpringBoot Example: Compensation Workflow

2 participants