I'm trying to understand how RabbitMQ behaves under failure conditions, specifically when using the Net::RabbitMQ Perl module.<br><br>We have RabbitMQ set up with three nodes, one on the backend, which holds the actual queues, and two on the frontend, which receive publish requests.<br>
<br>RabbitMQ 2.2.0<br>Net::RabbitMQ 0.1.8<br><br><br>Below is the chart of behaviors that I have observed.<br><br>"+" means the behavior is as I expected: either the message is successfully queued, or an error is thrown.<br>
"-" means the behavior is not as I expected, but can be managed: specifically, the process receives a SIGPIPE, which I can trap and recover from.<br>"!" means the behavior is not as I expected, and cannot be managed: the message is not queued but no error is thrown and/or the process hangs.<br>
<br>"App down" means I ran `rabbitmqctl stop_app`.� "Daemon down" means I ran `rabbitmqctl stop`.<br><br>� As publishing process starts up:<br><br>��� Remote daemon up, app up<br>����� + Everything okay<br>
<br>��� Remote daemon up, app down<br>����� ! Net::RabbitMQ hangs when declaring queue<br><br>��� Remote daemon down<br>����� + Net::RabbitMQ throws error when declaring queue<br>������� "Declaring queue: server channel error 404, message: NOT_FOUND - no queue 'test' in vhost '/'"<br>
<br>��� Local daemon up, app down<br>����� + Net::RabbitMQ throws error when connecting<br>������� "Opening socket: Connection refused"<br><br>��� Local daemon down<br>����� + Net::RabbitMQ throws error when connecting<br>
������� "Opening socket: Connection refused"<br><br><br>� After publishing process starts up:<br><br>��� Local app goes down<br>����� - Process receives SIGPIPE<br><br>��� Local daemon goes down<br>����� - Process receives SIGPIPE<br>
<br>��� Remote app goes down<br>����� ! Net::RabbitMQ falsely indicates success when publishing, then hangs (in DESTROY?)<br><br>��� Remote daemon goes down<br>����� ! Net::RabbitMQ falsely indicates success when publishing<br>
<br><br>��� Local app goes down, comes back up<br>����� - Process receives SIGPIPE<br><br>��� Local daemon goes down, comes back up<br>����� - Process receives SIGPIPE<br><br>��� Remote app goes down, comes back up<br>����� + Everything okay<br>
<br>��� Remote daemon goes down, comes back up<br>����� + Everything okay<br><br><br>Have other people had these problems with Net::RabbitMQ?� Can we resolve these issues by changing something in our RabbitMQ configuration?<br>
<br><br>thanks,<br>Ronald<br><br><br>P.S. Here's my script.<br><br>#!/usr/local/bin/perl<br><br>use strict;<br>use warnings;<br><br>use Net::RabbitMQ;<br><br>$| = 1;<br><br>$SIG{'PIPE'} = sub { die "SIGPIPE\n" };<br>
<br>my $mq = Net::RabbitMQ->new();<br><br>alarm(10);<br><br>print "Connecting\n";<br>$mq->connect('localhost', { user => 'engagement', password => '********' })<br>� or die "Can't connect to RabbitMQ\n";<br>
<br>print "Opening channel\n";<br>$mq->channel_open(1);<br><br>print "Declaring exchange\n";<br>$mq->exchange_declare(1, 'ee_exchange', { durable => 1 });<br><br>print "Declaring queue\n";<br>
$mq->queue_declare(1, 'test', { durable => 1 });<br><br>print "Binding queue\n";<br>$mq->queue_bind(1, 'test', 'ee_exchange', 'ee_test');<br><br>alarm(0);<br><br>print "> ";<br>
<>;<br><br>alarm(10);<br><br>print "Publishing message\n";<br>my $rc =<br>� $mq->publish(1, 'ee_test', 'hello world!',<br>�������������� { exchange => 'ee_exchange', mandatory => 1, immediate => 0 },<br>
�������������� { delivery_mode => 2 });<br>print "Result: $rc\n";<br><br>__END__<br><br>