消息总线和消息队列理解 [英] Message bus and Message queue understanding

查看:956
本文介绍了消息总线和消息队列理解的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道我对Message Bus和Message Queue的理解是否正确.

I would like to know if my understanding of Message Bus and Message Queue workings is correct.

首先,我需要清除名称,服务总线消息总线可以互换使用吗?这是一种发布者-订阅者类型的系统,可以向任意数量的发布者添加消息到消息集合中,并且可以从任意数量的订阅者那里读取消息,到目前为止,这是正确的吗?

First thing first, I need to clear the naming, a service bus is used interchangeably with message bus? It is a publisher-subscriber type of system where messages are added let's say to a message collection by any number of publishers and from where any number of subscribers can read, am i right so far ?

P1 ---                                         /``````S1
       \________ Service Bus Middleware ------+------ S2
       /           MESSAGE-COLLECTION          \______S3
P2 ---

我不明白的是

  1. 订阅者如何知道它感兴趣的消息,我的意思是显然订阅了它,但是如何知道订阅的消息呢?在哪里看到消息列表,这如何提供呢?通过API使用或怎么做?

  1. how does a subscriber know what message it is interested in, I mean it subscribes to it obviously, but how does it know to which message(s) it should subscribe?, Where does it see the message list, how is this available to it? via an API with or how ?

订户如何接收消息?

何时从MESSAGE-COLLECTION中删除一条消息?我能想象的是,每条消息都会保留一个计数器,该计数器代表一个订户成功处理该消息后递减的订户总数.

when is a message removed from MESSAGE-COLLECTION? What I can imagine is that some counter is kept for each message, the counter represents the total number of subscribers which gets decremented as soon as one subscriber successfully processed the message.

消息队列,也称为消息代理,是一种推挽式系统.有任何数量的生产者和任何数量的消费者.每个生产者为每个消费者创建一个队列,向其馈送消息.

A message queue also known as a message-broker is a push-pull type of system. There are any number of producers and any number of consumers. Each producer creates a queue per consumer to which it feeds messages.

             --- Message Queue 1 ---- C1
           /  
P1 ------ +
           \ 
             --- Message Queue 2 ---- C2


P2 ------ + --- Message Queue 1 ---- C1

既然是这种情况,则在使用者成功处理该消息后,该消息将被删除.我的消息队列对其工作原理的理解正确吗?

Since this is the case, the message gets removed as soon as the consumer successfully processes it. Are my message queue understanding of its workings correct ?

我不确定确切执行的另一个概念是事件中心.

Another concept that I'm not sure of what exactly does is event hub.

推荐答案

我想知道我对Message Bus和Message Queue的理解是否正确.

I would like to know if my understanding of Message Bus and Message Queue workings is correct.

一些评论/答案.这将是不全面的,因为许多方面是针对所使用的队列的.

Some comments/answers. This is not going to be comprehensive as many aspects are specific to the queue being used.

服务总线可与消息总线互换使用吗?

a service bus is used interchangeably with message bus?

对.服务总线是用于面向服务的解决方案中的消息总线基础结构,在服务之间提供了后端数据传输机制.

Right. A service bus is a message bus infrastructure used in service-oriented solution, providing the back-end data transport mechanism between the services.

这是一种发布者-订阅者类型的系统,其中,添加消息的数量可以由任意数量的发布者来定义,并且可以从任意数量的订阅者处读取

It is a publisher-subscriber type of system where messages are added let's say to a message collection by any number of publishers and from where any number of subscribers can read

通常有两种模型:

1)发布/订阅,其中发布者在不考虑特定目标的情况下将数据发送到总线.然后,一个或多个订阅者可以使用该消息(或不使用,请参阅下文).

1) Publish/Subscribe, where a publisher sends data to a bus without a specific target in mind. One or more subscribers can then consume the message (or not, see below).

2)请求/响应,其中发送方将数据发送到总线,但期望接收到的特定对象来处理消息并返回响应.

2) Request/Response, where a senders sends the data to the bus but expects a specific received to handle the message and return a response.

订户如何知道它对...感兴趣的消息?

how does a subscriber know what message it is interested in...?

大多数服务总线实现都使用路由键的概念.发送到总线的每个数据实体都带有一个密钥,订阅者随后可以使用该密钥进行过滤.

Most service bus implementations use the concept of routing keys. Each data entity sent to the bus is accompanied by a key that the subscribers can then filter by.

当然,订户还可以选择将所有消息发布到特定队列中.

Of course, subscribers may also choose to get all messages posted to a particular queue.

订户如何接收消息?

How does the subscriber receives the message ?

这在服务队列产品之间有所不同.例如,在RabbitMQ中,消息是通过API传递给订户的,而在Kafka中,客户端必须定期向服务器轮询消息.

This varies among service queue products. In RabbitMQ, for example, messages are delivered to a subscriber by the API whereas in Kafka, the client must poll the server periodically for messages.

何时从MESSAGE-COLLECTION中删除一条消息?

when is a message removed from MESSAGE-COLLECTION?

有时根本没有.这在产品和配置之间也有所不同.有时,一条消息仅传递给一个接收者,并在确认传递后将其删除,但是有时,这些消息会留在总线上,直到根据时间戳过期为止.许多情况都是可能的.

Sometimes not at all. This also varies both between products and configurations. Sometimes a message is delivered to only one receiver and is deleted once delivery has been confirmed, but sometimes messages are left on the bus until they are expired based on a time stamp. Many scenarios are possible.

这篇关于消息总线和消息队列理解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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