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

查看:365
本文介绍了微服务为何使用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天全站免登陆