I am reading this tutorial about RPC with RabbitMQ
seems following line close the queue channel:
d.Ack()
Could anyone explain what d.Ack()
is actually for? And why it happen to close the queue channel?
I am reading this tutorial about RPC with RabbitMQ
seems following line close the queue channel:
d.Ack()
Could anyone explain what d.Ack()
is actually for? And why it happen to close the queue channel?
Ack() acknowledges a delivery, and should be used when the acknowledgement mode is manual. See also Nack and Reject.
From Consumer Acknowledgements and Publisher Confirms
Depending on the acknowledgement mode used, RabbitMQ can consider a message to be successfully delivered either immediately after it is sent out (written to a TCP socket) or when an explicit ("manual") client acknowledgement is received.
Ack() might end up closing the channel since each message should be acknowledged not more than once, otherwise the channel gets closed due to an exception:
A message MUST not be acknowledged more than once. The receiving peer MUST validate that a non-zero delivery-tag refers to a delivered message, and raise a channel exception if this is not the case.