传奇,流程管理器和基于文档的方法之间有什么区别? [英] What is the difference between a saga, a process manager and a document-based approach?

查看:71
本文介绍了传奇,流程管理器和基于文档的方法之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我了解的是,这三个概念都与长期运行的事务有关。

What I understand is that all three concepts are related to long-running transactions.

据我所知,流程管理器是一种有限状态机,它仅会做出反应在事件上并发出命令。它不包含任何业务逻辑,而只是进行路由。它的目标是使您进入最终状态,在那里您知道您的交易成功或失败。

A process manager is, to my understanding, a finite state machine which simply reacts on events and emits commands. It does not contain any business logic, it just does routing. Its goal is to bring you to a final state, where you know that your transaction has succeeded or failed.

到目前为止,一切都很好。

So far, so good.

但是现在我的理解开始了:

But now my problems in understand start:


  • 与流程管理器相比,这是一个传奇吗? / li>
  • 还有一种基于文档的方法,如 CQRS sagas-我理解得对吗?…据我所知,文档只是一张纸,您可以在其中做笔记并交给他们。

  • What is a saga in contrast to a process manager?
  • There is also the document-based approach, as mentioned in CQRS sagas - did I understand them right? … as I understand it, a document is just a "piece of paper" where you take notes and hand it around. How does that fit into the concept of commands and events?

有人可以解释这些区别吗?-我特别要注意感兴趣-这些概念中的哪个对什么有好处,什么时候需要什么。它们相互排斥吗?您只能一路走下去吗?在某些情况下,您需要多个? …?

Can anybody please explain the differences, and - what I'd be especially interested in - which of these concepts is good for what, and when you do need what. Are they mutually exclusive? Can you go along all the way with only one of them? Are there scenarios where you need more than one? …?

推荐答案


与流程管理器相比,传奇是什么?

What is a saga in contrast to a process manager?

这些模式的意图是不同的。流程管理器是一种工作流模式,可以说,它可以建立在状态机之上。流程管理器将保留消息之间的状态,并将包含逻辑以确定响应消息而应采取的操作(例如,转换状态或发送其他消息)。

The intent of these patterns is different. A process manager is a workflow pattern which can, as you say, be built on top of a state machine. A process manager will retain state between messages, and will contain logic in order to determine which action should be taken in response to a message (for example, transitioning state or sending another message). Some frameworks incorrectly refer to these as sagas.

相反,传奇(根据原始定义)是旨在帮助管理故障的模式。它涉及跨系统的多个工作流,每个工作流都允许在其他事务失败的情况下在以后的交易中采取某种形式的补偿措施。

By contrast, a saga (according to the original definitions) is a pattern intended to help manage failures. It involves multiple workflows across systems, where each will allow some form of compensating action to be taken in a later transaction in the case of a failure elsewhere.

此补偿是传奇的定义特征。请注意,传奇本身不知道补偿动作可能是什么。 Sagas通常是使用路由转移模式实现的。

This compensation is the defining characteristic of a saga. Note that the saga itself does't know what the compensating action might be. Sagas are often implemented using the routing slip pattern.


它们相互排斥吗?您可以只使用其中的一个吗?

Are they mutually exclusive? Can you go along all the way with only one of them?

它们并不是互斥的-例如,参与传奇的系统可能会使用流程管理器来实际处理其处理。

They aren't mutually exclusive - it's likely that, for example, a system participating in a saga might use a process manager to actually handle its piece of processing.

其他资源

其中一些帖子可能有助于提供更多详细信息并提供示例:

Some of these posts may help provide more detail and provide examples:

  • Sagas and Workflows - same thing with different names or not (Arnon Rotem-gal-oz)
  • Clarifying the Saga pattern (Kelly Sommers)
  • Sagas (Clemens Vasters)

这篇关于传奇,流程管理器和基于文档的方法之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆