temporalio / temporalio/samples-java

[Sample Request] Payment workflow with idempotency, state machine, and compensation flow

Open
#770 0 comments 0 reactions 0 assignees View on GitHub

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.