Subject: | Net:RabbitMQ does not handle returned messages |
Date: | Wed, 27 Oct 2010 18:22:10 -0400 |
To: | <bug-Net-RabbitMQ [...] rt.cpan.org> |
From: | "Keith Minkler" <kminkler [...] synacor.com> |
Version: Net-RabbitMQ-0.1.8
Perl Version: 5.8.8
OS: Linux 2.6.18-164.el5 #1 SMP Thu Sep 3 03:28:30 EDT 2009 x86_64
x86_64 x86_64 GNU/Linux
The Problem:
------------
When messages are sent to AMQP with the 'mandatory' or 'immediate'
flags, and the message is not delivered, the server will call
Basic.Return to send the message back to the sender.
This should trigger an exception condition (or some other means of
detecting the fault) in the library so that the client application can
know the message was not enqueued on the server.
This message is silently ignored by Net::RabbitMQ.
Code:
-----
use Net::RabbitMQ;
my $mq = Net::RabbitMQ->new();
my $result = $mq->connect("localhost", {"user" => "guest", "password" =>
"guest"});
$result = $mq->channel_open(1);
$result = $mq->publish(1, 'missing_queue', 'message', {'mandatory' => 1,
'immediate' => 1});
$mq->disconnect();
Expected Result:
----------------
Some error indicating that message I tried to publish did not get
delivered to a queue
Actual Result:
--------------
No error raised. strace reveals that the NO_ROUTE error is being sent
to the client from the server, but the client is not handling/raising
the exception:
$ strace -s 4096 perl test.pl 2>&1 | grep NO_ROUTE
read(3,
"\1\0\1\0\0\0\36\0<\0002\0018\10NO_ROUTE\0\rmissing_queue\316\2\0\1\0\0\
0\16\0<\0\0\0\0\0\0\0\0\0\7\0\0\316\3\0\1\0\0\0\7message\316\1\0\0\0\0\0
\4\0\n\0=\316", 131072) = 87
Thanks,
Keith Minkler
Synacor, Inc.