RPC调用和强制转换是OpenStack中两种不同类型的消息传递协议。在RPC.call的情况下,调用者(或调用者)等待来自worker(被调用者)的回复或ack消息。
我试图拦截通过OpenStack中的rabbitmq系统传递的所有RPC消息(请求和响应消息)。在OpenStack中,所有请求消息都通过名为" nova"的单个交换。将新队列附加到" nova"交换,我可以捕获请求消息。
现在,我想捕获发送回被叫方的回复消息。可以通过" direct Consumer"捕获回复消息。由AMQP and Nova指定,摘录如下
a Direct Consumer comes to life if (an only if) a rpc.call operation is executed; this object is
instantiated and used to receive a response message from the queuing system; Every consumer connects to
a unique direct-based exchange via a unique exclusive queue; its life-cycle is limited to the message
delivery; the exchange and queue identifiers are determined by a *UUID generator*, and are marshaled in
the message sent by the Topic Publisher (only rpc.call operations).
为了捕获回复消息,我尝试连接到与相应的msg_id或request_id的直接交换。我不确定捕获特定rpc.call的回复的正确交换ID是什么。
知道什么是交换ID,我可以使用什么来捕获rpc.call消息的回复?什么是我附加的摘录中指定的 UUID生成器?
答案 0 :(得分:0)
我不知道OpenStack实现的细节,但在对消息系统进行RPC时,通常消息带有一个correlation_id
标识符,用于跟踪请求。
请参阅:http://www.rabbitmq.com/tutorials/tutorial-six-python.html