知识卡片

结构图卡 · 2411.c.5.b

Saga状态机暴露恢复路径

理解等级:中级

Saga状态机显式记录当前阶段、合法迁移以及触发动作。工单无可用专家时停在CREATED,无法送达或确认时停在ASSIGNED;已接受工单可完成或进入REASSIGN,调查失败则进入NO_SURVEY重试。状态与迁移表使实现者知道何时等待、重试、重新分派,避免把错误当作无名失败。状态机描述领域路径,不自动提供执行引擎;迁移和纠错代码仍需设计实现。

结构图:

stateDiagram-v2
    [*] --> CREATED
    CREATED --> ASSIGNED: 找到专家
    ASSIGNED --> ACCEPTED: 专家确认
    ACCEPTED --> REASSIGN: 无法完成
    REASSIGN --> ASSIGNED: 重新分派
    ACCEPTED --> COMPLETED: 完成维修
    COMPLETED --> CLOSED: 调查发出
    COMPLETED --> NO_SURVEY: 调查失败
    NO_SURVEY --> CLOSED: 重试成功
    CLOSED --> [*]
这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 事务Saga · 查看原书依据

      A state machine is a pattern that describes all of the possible paths that can exist within a distributed architecture. A state machine always starts with a beginning state that launches the transactional saga, then contains transition states and corresponding action that should occur when the transition state happens.

    参考来源

    - 位置:《Software Architecture The Hard Parts Modern Trade-Off Analyses for Distributed Architectures (Neal Ford, Mark Richards, Pramod Sadalage etc.)》第12章《Chapter 12. Transactional Sagas》(来源项目:book-sources;源文件:extracted/Software Architecture The Hard Parts Modern Trade-Off Analyses for Distributed Architectures (Neal Ford, Mark Richards, Pramod Sadalage etc.)/_epub-src/OEBPS/ch12.xhtml) - 结论依据:原文的定义、示例或失败路径支持以下归纳:Saga状态机显式记录当前阶段、合法迁移以及触发动作。 其他条件结合本章同小节说明;不将模式目标当成已有运行保证。 - 原始内容:A state machine is a pattern that describes all of the possible paths that can exist within a distributed architecture. A state machine always starts with a beginning state that launches the transactional saga, then contains transition states and corresponding action that should occur when the transition state happens.