temporalio / temporalio/samples-java

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

未关闭
#770 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Java
星标
258
派生
189
平均合并
6 天 4 小时
30 天内合并 PR
4

描述

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.

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先阅读现有的 HelloSaga 和 MoneyTransfer sample,以了解 SAGA 和 compensation 的演示方式。围绕所要求的七个状态、幂等性处理、retry backoff 以及 child-workflow compensation 定义该 sample;当一个完整统一的 payment workflow 演示出全部四种行为时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
backend, distributed-systems
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。