[rabbitmq-discuss] AMQP basic_recover
Tomas Bartkus
to.bartkus at gmail.com
Mon Feb 14 13:22:02 GMT 2011
Hello,
I have this is a piece of code to process a message:
public function processMessage($message)
{
try{
execute($message);
$this->_queue->remove($message);
$this->_queue->commit();
} catch (Exception $e) {
$this->_queue->getChannel()->basic_reject($message->getId(),
true);
//$this->_queue->getChannel()->basic_recover(true);
$this->_queue->rollback();
}
}
All I want to do is just to redeliver a message after some exception occurs.
But if I use basic_recover(true)I get an error - "PRECONDITION_FAILED -
unknown delivery tag 2".
Then I have noticed for example when I ask to redeliver a message with
delivery tag [1] (because I have got an exception) I get a second message
with delivery tag [2] and once I try to commit it I get "PRECONDITION_FAILED
- unknown delivery tag 2". Its like if X message fails and I ask to
redeliver it, next X+1 message that arrives, will fail witn an error
"PRECONDITION_FAILED
- unknown delivery tag X+1" when i will try to commit it.
Then I have tried to use basic_reject($message->getId(), true); and it
works, all messages are redelivered.
Perhaps I am doing something wrong here regarding basic_recover?
I am using RabbitMQ 2.3.1
Thank you for your answers!
Tomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110214/2091d2bd/attachment.htm>
More information about the rabbitmq-discuss
mailing list