2013-08-30 2 views
1

설정에 전달되지RabbitMQ 및 PHP-amqplib 메시지 소비자

0,123,516 :

나는

'amqp_consumer_non_blocking.php이'로 기다리고 앉아 또 다른 '이 테스트는 amqp_publisher.php PHP'에, 'PHP는 amqp_consumer_non_blocking.php'를 실행 한 콘솔에서

amqp_publisher.php

< 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 

메시지가 배달되지 않는 것으로 보이는 :

< 60,20: Basic.consume 
waiting for 60,21 
waiting for a new frame 
> 60,21: Basic.consume_ok 

와 'amqp_publisher.php'는이 생산하고 있습니다.

그러나, 나는 또 다른 가상 시스템에서 이러한 스크립트 (를 CentOS 6.2, 토끼 3.1.3, PHP 5.4.3)를 실행하고 'amqp_publisher.php'에서 다음을 얻을 수있다 :

< 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 

그리고 이쪽으로부터 소비자 스크립트 :

< 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로보고되었습니다. 메시지가 배달되지 않는 이유는 무엇입니까?

답변

3

Matthias Radestock은 올바른 방향으로 나를 가리켜 리소스 문제처럼 보였다고 말하고 서버 로그를 확인하도록 조언합니다. 나는 /var/log/rabbitmq/rabbit\@localhost.log에 다음을 발견

=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 '[email protected]'. 

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

만든 파일 /etc/rabbitmq/rabbitmq.config 다음과 같은 추가 :을 다시 시작

[{rabbit, [{disk_free_limit, 100000000}]}]. 

을 RabbitMQ & 이제 &을 예상대로 사용하여 게시 할 수 있습니다.