AMQP 客户端与同步消息的正确行为

发布于 2024-10-07 19:05:53 字数 737 浏览 10 评论 0原文

我最近遇到了一个实现 AMQP 客户端协议的流行库的问题。 AMQP 规范定义了同步和异步消息。问题是我一个接一个地发送了两个同步请求,而没有等待第一个请求完成,并且 RabbitMQ 服务器以相反的顺序响应。图书馆希望响应的顺序与发送请求的顺序相同。这是库中的错误还是我的误用?

问题是:AMQP 客户端是否应该自行负责序列化同步调用?

以下是我发现的一些相关参考资料。规范文件 [1] 第 2.2.1 节内容如下:

为了使方法处理简单,我们为每个同步请求定义不同的回复。也就是说,没有 方法用作两个不同请求的回复。这意味着对等方发送同步 请求,可以接受并处理传入的方法,直到获得有效的同步回复之一。这 AMQP 与更传统的 RPC 协议不同。

这里的误解是作者的意思是传入方法的处理仅限于异步调用(如 basic_deliver),还是还包括对不同同步调用的响应。

[1] http: //www.amqp.org/confluence/download/attachments/720900/amqp0-9-1.pdf?version=1&modificationDate=1227526523000

I recently crushed into a problem with one of the popular libraries implementing AMQP client protocol. AMQP specification defines synchronous and asynchronous messages. The problem is that I sent two synchronous requests one by one without waiting for the the first to finish and RabbitMQ server responded in reversed order. The library expected the responses to come in the same order the requests were sent. Is this a bug in the library or my misusage ?

The question is: should the AMQP client take care on its own to serialize the synchronous calls?

Below are some references which I found related. The specification document [1] section 2.2.1 says the following:

To make method processing simple, we define distinct replies for each synchronous request. That is, no
method is used as the reply for two different requests. This means that a peer, sending a synchronous
request, can accept and process incoming methods until getting one of the valid synchronous replies. This
differentiates AMQP from more traditional RPC protocols.

The misunderstanding here is whether the author meant that processing of incoming methods is limited to asynchronous calls (like basic_deliver) or does it also include responses to different synchronous calls.

[1] http://www.amqp.org/confluence/download/attachments/720900/amqp0-9-1.pdf?version=1&modificationDate=1227526523000

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

新雨望断虹 2024-10-14 19:05:53

您的 Amqp 客户端库应通过在发送同步后等待相应的响应消息来强制执行同步消息。信息。这里的一个例外是使用“no-wait”字段并将值设置为 true,某些方法允许这样做,在这种情况下,客户端库不应等待响应,因为 no-wait 标志实际上表示“不”不要向我发送回复消息”。

顺便说一句,您使用哪个客户端库?

Your Amqp client library should enforce synchronous messages by waiting for the corresponding response message after sending an sync. message. One exception here is to use a 'no-wait' field and set the value to true, certain methods allow this, and in this case the client library should not wait for a response, as the no-wait flag effectively says "don't send me the response message".

BTW, which client library are you using?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文