RabbitMQ: d.Ack() 关闭通道
RabbitMQ: d.Ack() close channel
我正在阅读这篇关于 RPC 与 RabbitMQ 的文章tutorial
似乎以下行关闭了队列通道:
d.Ack()
谁能解释一下 d.Ack()
的实际用途?为什么它恰好关闭了队列通道?
Ack()确认送达,确认方式为手动时使用。另见 Nack 和 Reject。
来自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() 可能最终会关闭通道,因为每条消息的确认不应超过一次,否则通道会因异常而关闭:
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.
我正在阅读这篇关于 RPC 与 RabbitMQ 的文章tutorial
似乎以下行关闭了队列通道:
d.Ack()
谁能解释一下 d.Ack()
的实际用途?为什么它恰好关闭了队列通道?
Ack()确认送达,确认方式为手动时使用。另见 Nack 和 Reject。
来自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() 可能最终会关闭通道,因为每条消息的确认不应超过一次,否则通道会因异常而关闭:
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.