[rabbitmq-discuss] Difference between get and consume.

Alan Antonuk alan.antonuk at gmail.com
Tue Nov 19 05:57:41 GMT 2013


On Thu, Nov 14, 2013 at 12:14 PM, William Weens <william.weens at gmail.com>wrote:
> Suppose you start to consume (amqp_basic_consume) and loop over the frames
> when a exception is thrown and you exit the loop.
> Remaining messages in the queue are consumed but not examined anymore :
> - is there a way to find these "lost" messages ?

Yes. Any messages that are delivered, but not acked by the client will be
redelivered by the broker in the event an exception is returned to the
client. (assuming you didn't specify no_ack when setting up your consumer).
Depending on the type of exception (channel or connection) you will need to
open a new channel, and create a new consumer to get these messages

> Won't it be safer to get one, handle it, catch exceptions if any and then
> move to the other one ?

You should handle exceptions as they're received by the client. Attempting
to use a channel after it has thrown an exception will result in a
connection exception being thrown (which means you'd need to close and
re-open the entire connection).

- if yes, does "get" method consume the message as well ?
Get synchronously polls the broker for new messages. It does have the same
effect of removing a message from the front of the queue in question on the

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20131118/22559c45/attachment.htm>

More information about the rabbitmq-discuss mailing list