I'm trying to send a bunch of methods on a single channel to RabbitMQ server in a pipeline and then wait for corresponding synchronous responses. I'm observing a following artifact:
Client request pipeline:
Exchange.Declare
-> Queue.Declare
-> Queue.Bind
-> Basic.Consume
-> Basic.Qos
Server response pipeline:
Exchange.DeclareOk
-> Queue.DeclareOk
-> Queue.BindOk
-> Basic.QosOk
-> Basic.ConsumeOk
Notice how the response Basic.ConsumeOk
is coming after the Basic.QosOk
, even though the order of requests in pipeline was different. Reading the specs I came to a conclusion that in between a synchronous request and a corresponding response only an asynchronous methods can be received (Basic.Deliver
, Basic.Return
, Channel.Flow
, Connection.Close
, Channel.Close
).
Otherwise, if for example I issue a several Queue.Declare
requests or even Basic.Consume
requests in a row it would be impossible to know which response corresponds to which requests if order is not preserved.
Is this considered normal? Is my understanding is flawed? Or maybe pipelining is not supported by RabbitMQ?
I'm assuming you're using a custom library or your own code because pipelining is not supported by RabbitMQ or any of the client libraries that we maintain. It's easy to see when you run some code using an officially supported library.
When I run the sequence of methods you describe using Pika, I see requests and responses sent in the order expected.
I modified receive.py
in the code here as well as included a packet capture from my machine.
I'm using RabbitMQ 3.7.13, Erlang 21.3.2, Python 3.7.2 and Pika 0.13.1.