douxing8939 2017-11-25 11:29
浏览 391
已采纳

RabbitMQ:d.Ack()关闭频道

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?

  • 写回答

1条回答 默认 最新

  • duanguoyin7008 2017-11-25 13:01
    关注

    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:

    AMQP basic acknowledgement:

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大