temporalio / temporalio/sdk-java

Run Saga compensations in a disconnected scope

Open
#305 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
433
Forks
249
Avg merge
5d 6h
Merged PRs (30d)
26

Description

Is your feature request related to a problem? Please describe.
Currently Saga.compensate is called in the current cancellation scope. It means that in the case of cancellation the compensations are not going to run. So it requires that compensate is called in the detached cancellation scope. But our sample does not do it.

Describe the solution you'd like
By default execute compensation actions in a disconnected cancellation scope. Add Saga.Option to disable this behavior.
Change bookingsaga sample to catch TemporalFailure to support cancellation scenarios.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Saga compensation implementation and its Option API, then inspect src/main/java/io/temporal/samples/bookingsaga/TripBookingWorkflowImpl.java. Verify how cancellation affects compensation and how the sample currently handles failures. Done means compensations run in a disconnected scope by default, an option can disable that behavior, and the bookingsaga sample supports cancellation scenarios.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, distributed-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.