首页 > 解决方案 > 为什么 RabbitMQ 客户端在将实际消息体发送到 RabbitMQ 代理之前发送一个方法帧和一个内容帧?

问题描述

我正在阅读这本书“RabbitMQ in Depth”,它描述了每当客户端想要发布消息时客户端如何与代理进行通信。它说从客户端到代理至少进行了 3 次 RPC 调用:

When publishing messages to RabbitMQ, multiple frames encapsulate the message data that’s
sent to the server. Before the actual message content ever reaches RabbitMQ, the client 
application sends a Basic.Publish method frame, a content header frame, and at least one 
body frame

When RabbitMQ receives all of the frames for a message, it will inspect the information
it needs from the method frame before determining the next steps. 

Method Frame --> 告诉代理客户端想要发布消息

内容框架 ---> 告诉代理有关消息的详细信息,例如大小。

一个或多个 Body Frames --> 这包含实际数据。

我可以理解为什么 rabbitmq 客户端可能需要发送多个正文帧,因为数据可能太大而无法在单个帧中发送。但是有一个单独的方法和内容框架有什么用呢?为什么客户端不只是将它与第一个主体框架一起发送,或者只是同时发送方法和内容框架?

标签: rabbitmqrabbitmq-exchange

解决方案


推荐阅读