[rabbitmq-discuss] PHP amqp 0.9.1 breaks after rabbitmq server upgrade to 3.1
Matthias Radestock
matthias at rabbitmq.com
Wed May 8 06:00:16 BST 2013
On 08/05/13 02:57, elad wrote:
> hey guys, here is the code I use:
> $conn_args = array('host' => '127.0.0.1', 'port' => '5672', 'login'
> => 'Administrator', 'password' => 'admin');
> $cnn = new AMQPConnection($conn_args);
> $cnn->connect();
>
> $ch = new AMQPChannel($cnn);
> $ch->setPrefetchCount(1);
>
> $q = new AMQPQueue($ch);
> $q->setName('app_event');
> $q->setFlags(AMQP_DURABLE);
> $q->declare();
>
> while($message = $q->get()) {
> echo("Message #".$message->getDeliveryTag()."
> '".$message->getBody()."'");
> }
>
>
> It get stuck and I get an exception that the connection closed unexpectedly.
>
> if I set $ch->setPrefetchCount(1) to 0, then everything works.
>
> The funny thing is that with rabbitmq 3.0 (previous version) all worked
> perfect and I didnt change the amqp lib.
>
> any ideas ?
As I noted yesterday -
http://rabbitmq.1065348.n5.nabble.com/PHP-amqp-0-9-1-breaks-after-rabbitmq-server-upgrade-to-3-1-tp26461p26488.html
- this is a (new) bug.
Btw, setting the prefetch in the above code is actually pointless. You
are retrieving messages with basic.get, which is not subject to prefetch
counts since it fetches one message at a time anyway.
Matthias.
More information about the rabbitmq-discuss
mailing list