首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >RabbitMQ & php-amqplib -消息未传递给消费者

RabbitMQ & php-amqplib -消息未传递给消费者
EN

Stack Overflow用户
提问于 2013-08-30 18:17:37
回答 1查看 1.5K关注 0票数 1

设置: Centos 6.2、RabbitMQ 3.1.3、PHP5.4.3

我正在尝试从php-amqlib运行演示脚本,特别是amqp_consumer_non_blocking.php & amqp_publisher.php

在一个控制台中,我运行'php amqp_consumer_non_blocking.php',在另一个控制台中运行'php amqp_publisher.php This is a test‘。

“amqp_consumer_non_blocking.php”坐着等着:

代码语言:javascript
复制
< 60,20: Basic.consume
waiting for 60,21
waiting for a new frame
> 60,21: Basic.consume_ok

而'amqp_publisher.php‘会产生这样的结果:

代码语言:javascript
复制
< 60,40: Basic.publish
< [hex]:
0000  02 00 01 00 00 00 1A 00  3C 00 00 00 00 00 00 00   ........ <.......
0010  00 00 0E 90 00 0A 74 65  78 74 2F 70 6C 61 69 6E   .....te xt/plain
0020  02 CE                                              .Î

< [hex]:
0000  03 00 01 00 00 00 0E 54  68 69 73 20 69 73 20 61   .......T his is a
0010  20 74 65 73 74 CE                                   testÎ

< [hex]:
0000  01 00 01 00 00 00 0B 00  14 00 28 00 00 00 00 00   ........ ..(.....
0010  00 00 CE                                           ..Î

< 20,40: Channel.close
waiting for 20,41
waiting for a new frame

这条信息似乎没有得到传递。

然而,我已经在另一个虚拟机(Centos 6.2,Rabbit 3.1.3,PHP 5.4.3)上运行了这些脚本,并从‘amqp_Publisher.php’获得了以下内容:

代码语言:javascript
复制
< 60,40: Basic.publish
< [hex]:
0000  02 00 01 00 00 00 1A 00  3C 00 00 00 00 00 00 00   ........ <.......
0010  00 00 0E 90 00 0A 74 65  78 74 2F 70 6C 61 69 6E   .....te xt/plain
0020  02 CE                                              .Î

< [hex]:
0000  03 00 01 00 00 00 0E 54  68 69 73 20 69 73 20 61   .......T his is a
0010  20 74 65 73 74 CE                                   testÎ

< [hex]:
0000  01 00 01 00 00 00 0B 00  14 00 28 00 00 00 00 00   ........ ..(.....
0010  00 00 CE                                           ..Î

< 20,40: Channel.close
waiting for 20,41
waiting for a new frame
> 20,41: Channel.close_ok
< [hex]:
0000  01 00 00 00 00 00 0B 00  0A 00 32 00 00 00 00 00   ........ ..2.....
0010  00 00 CE                                           ..Î

< 10,50: Connection.close
waiting for 10,51
waiting for a new frame
> 10,51: Connection.close_ok
closing socket

下面是来自消费者脚本的内容:

代码语言:javascript
复制
< 60,20: Basic.consume 
waiting for 60,21
waiting for a new frame
> 60,21: Basic.consume_ok
waiting for any method
waiting for a new frame
> 60,60: Basic.deliver
waiting for a new frame
waiting for a new frame

--------
This is a test
--------
< [hex]:
0000  01 00 01 00 00 00 0D 00  3C 00 50 00 00 00 00 00   ........ <.P.....
0010  00 00 01 00 CE                                     ....Î

< 60,80: Basic.ack

在成功的示例中,我可以看到返回的delivery_mode为2。消息未送达的原因可能是什么?

EN

回答 1

Stack Overflow用户

发布于 2013-09-02 17:49:28

Matthias Radestock向我指出了正确的方向,他认为这看起来像是一个资源问题,并建议我检查服务器日志。我在/var/log/rabbitmq/rabbit\@localhost.log中找到了以下内容:

代码语言:javascript
复制
=INFO REPORT==== 02-Sep-2013::12:48:48 ===
Disk free limit set to 1000MB

=INFO REPORT==== 02-Sep-2013::12:48:48 ===
Disk free space insufficient. Free bytes:588042240 Limit:1000000000

=WARNING REPORT==== 02-Sep-2013::12:48:48 ===
disk resource limit alarm set on node 'rabbit@localhost'.

**********************************************************
*** Publishers will be blocked until this alarm clears ***
**********************************************************

创建了文件/etc/rabbitmq/rabbitmq.config,并添加了以下内容:

代码语言:javascript
复制
[{rabbit, [{disk_free_limit, 100000000}]}].

重新启动了RabbitMQ &现在我可以按预期发布和消费了。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18530495

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档