[rabbitmq-discuss] Understanding Basic Get and Consume
mklishin at gopivotal.com
Thu Jun 5 11:46:00 BST 2014
On 5 June 2014 at 14:42:05, Thomas Mutton (tmutton1 at gmail.com) wrote:
> > I have two brokers set up in a federation.
Queue or exchange federation?
> Using the RabbitMQ .NET library, I am able to publish and consume
> messages from and to either end respectively. This works.
> Dropping out of .NET, I am attempting to consume a message via
> command line (rabbitmqadmin script). The call I'm using is get.
> From what I understand (looking into the docs), this is a synchronous
> call - so it's a call from the client to the broker. What happens
> when the command gets to the broker is broker A asks broker B for
> any messages (using the upstream). Messages (if any) then get
> passed to broker Afrom broker B. This all happens asynchronously.
> My question is: Is there an asynchronous call I can make from the
> command line to get a message over a federation like the one described
> above? I have heard about consume but have not seen any examples
> and according to the rabbitmqadmin script, it does not recognise
> My second question is: Given that get is synchronous and consume
> is asynchronous, what is going on under the hood? Where is the
> difference? Are they both calls to the broker but consume waits
> for a response?
basic.get fetches 1 message at a time (like HTTP GET). basic.consume creates
a (supposedly long running) subscription which means RabbitMQ will push messages
to the consumer.
basic.get cannot retrieve messages from federated queues over federation for the reason you've mentioned:
it has to wait for a response. See Limitations on http://www.rabbitmq.com/federated-queues.html.
Software Engineer, Pivotal/RabbitMQ
More information about the rabbitmq-discuss