返回主题:引擎运行时与状态管理

知识卡片

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

支付入队牵连其他步骤

理解等级:中级

支付服务依赖故障时,若把支付请求放入队列并返回202,调用者可能已扣减库存、安排发货。此时支付尚未完成,其他步骤却已承诺,调用者必须面对等待、取消或回退的选择。

问题不只是内部队列能否可靠消费,而是“已接受”和“已完成”的业务语义不同;隐藏延迟可能使整个订单流程继续执行错误的后续动作。它说明延后处理需要接口级协调,不能假装与同步完成完全等价。[[入队响应公开处理进度]]给出相应接口方案。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 超媒体服务 · 查看原书依据

      Returning 202 Accepted to the API caller might create a mess on their end. Maybe they have already committed to decrementing inventory and scheduling a delivery of purchased goods. They will now need to decide if they should “unroll” those other activities, leave them in place, and not tell the calling API about it, or offer the calling API an option to wait or cancel the activities.

    参考来源

    - 位置:《RESTful Web API Patterns and Practices Cookbook》第5章《Hypermedia Services》(来源项目book-sources:extracted/RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)/_epub-src/OEBPS/ch05.xhtml,配方5.16) - 结论依据:原文以支付排队时库存和配送可能已承诺为例,说明202受理会牵动调用方协调;本卡只解释问题。 - 原始内容:Returning 202 Accepted to the API caller might create a mess on their end. Maybe they have already committed to decrementing inventory and scheduling a delivery of purchased goods. They will now need to decide if they should “unroll” those other activities, leave them in place, and not tell the calling API about it, or offer the calling API an option to wait or cancel the activities.