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