[rabbitmq-discuss] getting duplicated delivery

Billy Hand billythethird at gmail.com
Thu May 16 17:53:49 BST 2013


Well I should add that I'm using PHP and the PECL bindings for the
rabbitmq-c library.  So I've been able to determine the exact repro steps.
1. get (no_ack off)
2. ack
3. get again, the connection drops, the message gets redelivered

The exact same code connecting to rabbitmq 3.0.4 does not have this problem
so I'm guessing something broke with the PHP bindings or rabbitmq-c between
versions.  I leave room for a misconfiguration of rabbitmq on my part but
other than setting up a user/password and giving it full access to the /
vhost I didn't do much configuration on either.  Here is the code I'm using:

Producer:
<?php

$co = new AMQPConnection();
$co->setLogin('user');
$co->setPassword('password');
$co->setTimeout(60);
$co->connect();

$ch = new AMQPChannel($co);

$ex_name = 'test_exchange';
$ex = new AMQPExchange($ch);
$ex->setName($ex_name);
$ex->setType(AMQP_EX_TYPE_DIRECT);
$ex->declare();

$q_name = 'test_queue';
$q = new AMQPQueue($ch);
$q->setName($q_name);
$q->setFlags(AMQP_DURABLE);
$q->declare();
$q->bind($ex_name, $q_name);

$ex->publish('test_message'.microtime(true), $q_name);

Consumer:
<?php

$co = new AMQPConnection();
$co->setLogin('user');
$co->setPassword('password');
$co->setTimeout(0);
$co->connect();

$ch = new AMQPChannel($co);

$ex_name = 'test_exchange';
$ex = new AMQPExchange($ch);
$ex->setName($ex_name);
$ex->setType(AMQP_EX_TYPE_DIRECT);
$ex->declare();

$q_name = 'test_queue';
$q = new AMQPQueue($ch);
$q->setName($q_name);
$q->setFlags(AMQP_DURABLE);
$q->declare();
$q->bind($ex_name, $q_name);

while (true) {
  //$envelope = $q->get(AMQP_AUTOACK);
  $envelope = $q->get();
  if ($envelope) {
    echo $envelope->getBody() ."\n";
    $q->ack($envelope->getDeliveryTag());
    $envelope = false;
  }
}


On Thu, May 16, 2013 at 9:48 AM, Michael Klishin <
michael.s.klishin at gmail.com> wrote:

>
> 2013/5/16 Billy Hand <billythethird at gmail.com>
>
>> I'm using a short program I wrote that generates exactly one message.
>
>
> Can you post the code (of both the producer and consumers)?
> --
> MK
>
> http://github.com/michaelklishin
> http://twitter.com/michaelklishin
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130516/5ca59a8f/attachment.htm>


More information about the rabbitmq-discuss mailing list