temporalio / temporalio/samples-java
[Sample Request] Payment workflow with idempotency, state machine, and compensation flow
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 258
- Forks
- 189
- Avg merge
- 6d 4h
- Merged PRs (30d)
- 4
Description
Hi, I'd like to contribute a new sample demonstrating a production-grade payment workflow pattern.
What it would cover:
- 7-state payment state machine (INITIATED → VALIDATING → PROCESSING → COMPLETED / FAILED / CANCELLED / COMPENSATING)
- Idempotency key deduplication before any state mutation
- Exponential backoff with jitter on retries
- Compensation flow as a child workflow on failure
Why it's useful:
The existing HelloSaga and MoneyTransfer samples demonstrate SAGA and basic compensation, but none show the full combination of idempotency + state machine transitions + compensation in a single cohesive example. This pattern is extremely common in fintech/payment backends.
Happy to submit a PR if this is welcome. Let me know if there's a preferred package structure or naming convention I should follow.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing HelloSaga and MoneyTransfer samples to understand how SAGA and compensation are demonstrated. Define the sample around the requested seven states, idempotency handling, retry backoff, and child-workflow compensation; it is done when one cohesive payment workflow demonstrates all four behaviors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100