RabbitMQ 问题 记录
2012-10-08 03:01
183 查看
1. 如何确定一个队列是否为空?
http://rabbitmq.1065348.n5.nabble.com/check-if-queue-is-empty-td2129.html
1)
status = channel.queue_declare(queue=msgqueue)
if status.method.message_count == 0:
print "queue empty"
2)
Mark,
On 21/09/11 15:30, Mark K wrote:
> I noticed one thing.... the
> status.method.message_count doesn't always match the number in the queue. For
> example I have a situation now where there is one message in the queue, and I
> can get an accurate count using the Rabbitmq api/queues but the status.method
> reports no messages in the same queue.
That's because queue.declare et al return
<quote>
[The] number of messages present in the queue [...] that are not
awaiting acknowledgement.
</quote>
(from the AMQP 0-9-1 spec xml)
whereas the 'messages' figure in rabbitmqctl and management includes
messages awaiting acknowledgement. You can get a breakdown with, e.g.,
rabbitmqctl list_queues name messages_ready messages_unacknowledged
The messages_ready count should correspond to the count returned by the
AMQP commands.
Matthias.
http://rabbitmq.1065348.n5.nabble.com/check-if-queue-is-empty-td2129.html
1)
status = channel.queue_declare(queue=msgqueue)
if status.method.message_count == 0:
print "queue empty"
2)
Mark,
On 21/09/11 15:30, Mark K wrote:
> I noticed one thing.... the
> status.method.message_count doesn't always match the number in the queue. For
> example I have a situation now where there is one message in the queue, and I
> can get an accurate count using the Rabbitmq api/queues but the status.method
> reports no messages in the same queue.
That's because queue.declare et al return
<quote>
[The] number of messages present in the queue [...] that are not
awaiting acknowledgement.
</quote>
(from the AMQP 0-9-1 spec xml)
whereas the 'messages' figure in rabbitmqctl and management includes
messages awaiting acknowledgement. You can get a breakdown with, e.g.,
rabbitmqctl list_queues name messages_ready messages_unacknowledged
The messages_ready count should correspond to the count returned by the
AMQP commands.
Matthias.
相关文章推荐
- RabbitMQ 问题记录
- RabbitMQ初学之安装与常见问题记录
- RabbitMQ 问题记录
- linux下安装rabbitmq的rpm包问题记录
- [问题记录]解决RabbitMQ消息丢失与重复消费问题
- 面试随笔——记录一些面试中碰到的问题(初级/中级Java开发)
- RN学习过程中遇到的问题记录
- css中的小问题记录
- JAVA代码—算法基础:学生出勤记录问题
- 持续记录-修改--写写自己Android学习中遇到的关键性问题
- Python 问题记录
- poj 迷宫问题(路径记录)(DFS,BFS)
- [Django] 问题记录追踪表
- ios 问题记录篇(1)
- 配置phpMyAdmin出现小问题【问题记录】
- jquery文件上传控件 Uploadify 问题记录
- 开发错误记录6----友盟社会化分享与支付宝-微信支付问题
- 记录一个软中断问题
- ASIHTTPRequest iOS7下内存泄漏问题解决记录
- [问题记录.VisualStudio]VS2013无法新增和打开项目