微服务 为什么使用 RabbitMQ? [英] Microservices Why Use RabbitMQ?

查看:34
本文介绍了微服务 为什么使用 RabbitMQ?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我还没有找到一个现有的帖子来询问这个问题,但如果我错过了它,我深表歉意.

I haven't found an existing post asking this but apologize if I missed it.

我正在尝试深入了解微服务,并且遇到过使用 RabbitMQ 的文章.我很困惑为什么需要 RabbitMQ.服务的意图是使用 web api 与外界通信,并使用 RabbitMQ 相互通信吗?

I'm trying to get my head round microservices and have come across articles where RabbitMQ is used. I'm confused why RabbitMQ is needed. Is the intention that the services will use a web api to communicate with the outside world and RabbitMQ to communicate with each other?

推荐答案

在微服务架构中,微服务之间有两种通信方式:

In Microservices architecture you have two ways to communicate between the microservices:

  • 同步 - 即每个服务直接调用另一个微服务,这导致服务之间存在依赖关系
  • 异步 - 您有一些中央集线器(或消息队列),您可以在其中放置微服务之间的所有请求,相应的服务接收请求、处理请求并将结果返回给调用者.这就是 RabbitMQ(或任何其他消息队列 - MSMQ 和 Apache Kafka 是不错的选择)的用途.在这种情况下,所有微服务都只知道中心的存在.

microservices.io 有一些关于使用微服务的非常好的文章

microservices.io has some very nice articles about using microservices

这篇关于微服务 为什么使用 RabbitMQ?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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