How to move messages from Unacked to Ready state?

6,413 views
Skip to first unread message

Павел Ко

unread,
Apr 11, 2018, 3:45:31 AM4/11/18
to rabbitmq-users
I receive all messages from the queue, then on the basis of some values ​​from the message headers i form a filter, in order to discard/skip some messages, and to process remaining ones. 
The problem is that after receiving all the messages, to form a filter, these messages become Unacked, even if I do BasicNaсk multiple = true, requeue = true for last selected message. After disconnecting consumer by BasicCancel also nothing happens, they remain Unacked.
To, once again select messages for processing using the generated filter, i need to Close the session with and re-open it (CreateModel).
I suspect that there must be some other solution. Tell me where to dig?

Michael Klishin

unread,
Apr 11, 2018, 3:48:41 AM4/11/18
to rabbitm...@googlegroups.com
You can negatively acknowledge a delivery with requeue set to `true`,
see http://www.rabbitmq.com/confirms.html#server-sent-nacks.

Closing a channel is an OK solution and its has a benefit: you don't have to know what's the oldest (lowest)
delivery tag of the outstanding deliveries is. All outstanding deliveries will be requeued
automatically, as explained in http://www.rabbitmq.com/confirms.html#automatic-requeueing.

So I wouldn't call closing the channel to be a hacky solution. In fact, if the intent is to cancel a consumer
and requeue all unacknowledged messages it seems optimal to me. 

On 11 April 2018 at 10:45:36, Павел Ко (spider....@gmail.com) wrote:
> I receive all messages from the queue, then on the basis of some values
> from the message headers i form a filter, in order to discard/skip some
> messages, and to process remaining ones.
> The problem is that after receiving all the messages, to form a filter,
> these messages become *Unacked*, even if I do BasicNaсk multiple = true,
> requeue = true for last selected message. After disconnecting consumer by BasicCancel
> also nothing happens, they remain *Unacked*.
> To, once again select messages for processing using the generated filter, i
> need to Close the session with and re-open it (CreateModel).
> I suspect that there must be some other solution. Tell me where to dig?
>
> --
> You received this message because you are subscribed to the Google Groups "rabbitmq-users"
> group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
> To post to this group, send an email to rabbitm...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

--
MK

Staff Software Engineer, Pivotal/RabbitMQ


Павел Ко

unread,
Apr 11, 2018, 4:00:21 AM4/11/18
to rabbitmq-users
Thank you for your answer, Michael!

среда, 11 апреля 2018 г., 10:48:41 UTC+3 пользователь Michael Klishin написал:

Michael Klishin

unread,
Apr 11, 2018, 4:05:36 AM4/11/18
to rabbitm...@googlegroups.com
I now see the doc section linked conflates consumer and publisher confirms. Basically
IModel#BasicNack (or its more limited older brother IModel#BasicReject) are the .NET client
methods you are after.

Павел Ко

unread,
Apr 11, 2018, 4:29:38 AM4/11/18
to rabbitmq-users
Don'understand what you mean. Explain, please?

среда, 11 апреля 2018 г., 11:05:36 UTC+3 пользователь Michael Klishin написал:

Michael Klishin

unread,
Apr 11, 2018, 4:38:20 AM4/11/18
to rabbitm...@googlegroups.com
Well, I don't know what specifically is unclear but here's another take.

The doc section linked to talks about publisher confirms, so server -> client negative acknowledgements.

Consumers can negatively acknowledge a delivery using the same protocol method, basic.nack (or basic.reject),
including an option to requeue it. IModel#BasicNack and IModel#BasicReject are the .NET client methods for working
with those protocol operations.


To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages