微服务:什么是智能端点和哑管道? [英] Microservices: What are smart endpoints and dumb pipes?

查看:37
本文介绍了微服务:什么是智能端点和哑管道?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了 Martin Fowler 的一篇文章微服务",发现很难了解智能端点哑管道.请解释这些术语,欢迎举例.

I have read an article "Microservices" by Martin Fowler and find it difficult to understand smart endpoints and dumb pipes. Please explain these terms, examples are welcome.

推荐答案

我没有读过这篇文章,所以我只能推测他的确切意思,但正如他以 ESB 为例针对微服务和 ZeroMQ 作为一个例子以微服务为例,我希望我的推测非常准确:

I didn’t read the article, so I can only speculate what he can mean exactly, but as he gives ESB as an example against microservices and ZeroMQ as an example for micro services I hope my speculation will be pretty exact:

Unix(和Linux)的一个想法是构建小的独立应用程序并通过管道连接它们.我使用的可能最常见的两个命令集是 psgrep 像这样:ps aux |grep PROCESS_NAME - 在这里你可以看到一个哑管道,它只将 ps 的输出转发到 grep 的标准输入.

One of the ideas of Unix (and Linux) is to build small independent applications and connect them via pipes. The probably most common set of two command which I’m using is ps and greplike this: ps aux | grep PROCESS_NAME - here you can see a dumb pipe which only forwards the output of ps to stdin of grep.

ZeroMQ 等其他消息传递系统的工作方式类似,尽管它们可能具有更多的复杂性,例如循环分发和可靠交付.Erlang 作为一种语言建立在小型智能端点之上,在彼此之间发送消息.这里的优势很明显,文章也提到了,小应用更容易维护,解耦更容易扩展.

Other messaging systems like ZeroMQ work similarly, although they can have a little bit more complexity like round-robin distribution and reliable delivery. Erlang as a language is built on top of small smart endpoints sending messages between each other. The advantages here are obvious and also mentioned in the article, small applications are easier to maintain, decoupling makes it easier to scale.

另一方面,微服务是最常见的大型企业应用程序,例如前面提到的企业服务总线.我并没有真正与那些足以给你一个具体例子的人合作,但通常这些总线包含许多功能,这些功能要么通过脚本要么配置包含.此类功能主要包括具有高级路由的可配置工作流,甚至可以转换消息,因此不同的端点可以处理它们.

On the other hand of Microservices are most commonly big enterprise applications, like the mentioned Enterprise Service Bus. I didn’t really work with those enough to give you a specific example, but generally those busses contain a lot of functionality which is either included via scripts or configuration. Such functionality mostly includes a configureable Workflow with advanced routing and can even transform the messages, so different endpoints can handle them.

一个例子可能是 - 如果您希望在系统中执行一些高级操作,例如更改已经运行的项目中的需求,这可以启动一个工作流,其中 ESB 将自动向周围的不同参与者发送不同的通知这些更改的要求,并在应用此更改之前等待其中一个或多个参与者确认.这基本上是相反的 - 愚蠢的端点(它只是向/从总线发送/接收数据)和一个非常智能的管道(可以配置或编写脚本来处理所有可能的企业场景的总线).

An example could be - if you want the perform some advance action in a system, for instance change the requirements in an already running project, this could start a workflow, where the ESB would send out automatically different notifications to different actors around those changed requirements and wait for 1 or more of those actors to confirm before this change would be applied. Which would be basically the opposite - dumb endpoints (which just send/receive the data to/from the bus) and a very smart pipe (the bus, which can be configured or scripted to handle all possible enterprise scenarios).

我非常有信心存在处理类似场景的企业服务总线,这些总线与简单的哑巴"类似 ZeroMQ 的消息传递框架相反.

I’m pretty confident that there exist enterprise service busses which are handling similar scenarios and those are the opposite of simple "dumb" ZeroMQ-like message passing frameworks.

基本上,逻辑必须在某处实现——要么在大 ESB 中,要么在端点中.微服务的理念是将其放入端点而不是总线中,并具有与 unix 应用程序类似的理念.

Basically the logic has to be implemented somewhere - either in the big ESB, or in the endpoints. The idea of microservices is to put it into the endpoints rather than into the bus and have a similar philosophy as unix applications.

这篇关于微服务:什么是智能端点和哑管道?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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