[rabbitmq-discuss] Publish and ACK in different channels

Alexandru Scvorţov alexandru at rabbitmq.com
Wed Aug 11 12:12:21 BST 2010


Hi Vivek,

> So, I have my RabbitMQ running on machine A, and I give a API to Consumers
> who are operating on machine C. So, the user just calls a get method without
> knowing the details of RabbitMQ. My API, which apparently runs on Machine B,
> does all the back side job of opening a channel and getting the message.
> 
> Is there a way I can implement acknowledgment?
> 
> It appears to me that if I retrieved a message M through channel C, I have
> to acknowledge message M through Channel C only. So does my API needs to
> keep the channel open till the user gives back an acknowledgment? Or is
> there a better ( and cleaner ? ) way out?

The way AMQP works is that it re-enqueues unack'd messages on channel
close.  If you close the channel, there's no point in ack'ing the
messages; they're already on some queue waiting to be delivered to some
consumer (possibly, the same one).

What you could do, is auto-ack the messages when the middle layer gets
them.  Then, if a client says it doesn't want the message (the
equivalent of not sending an ack), the middle layer republishes the
message.  This may not be possible in your setup and will cause all
sorts of other problems.

Cheers,
Alex


More information about the rabbitmq-discuss mailing list