返回主题:业务事务与离线并发

此卡片不在当前主题的阅读序列中,可返回主题继续阅读。

知识卡片

支付系统案例卡 · 2277.o.3.b

扣款超时结果不明

理解等级:中级

账户扣除50积分的POST发出后,客户端没有收到响应,存在至少两种可能:请求未到服务端,或已扣款但成功响应丢失。客户端无法只凭超时判断业务是否发生;盲目重发非幂等请求可能再次扣款。这是网络结果不确定性造成的重复业务风险,而非简单的错误状态码问题。

对应方案见[[条件PUT保护写入]]。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 超媒体接口设计 · 查看原书依据

      Consider the case where a client application issues an HTTP POST to an account service to deduct 50 credits from an account and never gets a reply to that request. Did the request never arrive at the server? Did it arrive, get processed properly, and the client never received the 200 OK response? The real question is: should the client issue the request again?

    参考来源

    - 位置:《RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)》第03章《超媒体接口设计》(来源项目 book-sources;源文件:extracted/RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)/_epub-src/OEBPS/ch03.xhtml;小节:3.6) - 结论依据:原文以账户扣除50积分的POST发出后,客户端没有收到响应,存在至少两种可能:请求未到服务端,或已扣款但成功响应丢失的机制或场景为依据;同小节余文补充本卡所列条件,按2022年原书语境整理。 - 原始内容:Consider the case where a client application issues an HTTP POST to an account service to deduct 50 credits from an account and never gets a reply to that request. Did the request never arrive at the server? Did it arrive, get processed properly, and the client never received the 200 OK response? The real question is: should the client issue the request again?