Subject: | Net-RabbitMQ-0.0.1 |
Date: | Wed, 2 Dec 2009 12:47:31 +0000 |
To: | bug-Net-RabbitMQ [...] rt.cpan.org |
From: | Darren Gallagher <dazzag [...] gmail.com> |
uname -a
Linux foo 2.6.31-15-generic #50-Ubuntu SMP Tue Nov 10 14:53:52 UTC 2009
x86_64 GNU/Linux
RabbitMQ cloned from mercurial.
I have been unable to get any a simple demo working using the perl API.
I have a simple send script and a receive script.
Send:
#!/usr/bin/perl -w
use strict;
use Net::RabbitMQ;
binmode STDOUT, ":utf8";
my $mq = Net::RabbitMQ->new();
eval { $mq->connect("foo", { port => 5672, user => "guest", password =>
"guest" }); }; warn $@ if $@;
eval { $mq->channel_open(1); }; warn $@ if $@;
eval { $mq->publish(1, "test queue","Hello"); }; warn $@ if $@;
$mq->disconnect();
================
This runs with out error.
Recv:
#!/usr/bin/perl -w
use strict;
use Net::RabbitMQ;
binmode STDOUT, ":utf8";
my $mq = Net::RabbitMQ->new();
eval { $mq->connect("foo", { port => 5672, user => "guest", password =>
"guest" }); }; warn $@ if $@;
eval { $mq->channel_open(1); }; warn $@ if $@;
my $queue;
eval { $queue = $mq->queue_declare(1, ""); }; warn $@ if $@;
print "Using queue: " . $queue . "\n";
eval { $mq->queue_bind(1, $queue, "amq.direct", "test queue"); }; warn $@ if
$@;
eval { $mq->consume(1, $queue); }; warn $@ if $@;
while (1) {
my $msg;
eval { $msg = $mq->recv(); }; warn $@ if $@;
print $msg->body . "\n";
}
$mq->disconnect();
====================
This runs BUT never seems to receive a message.
What am I doing wrong?
I have compared the code in the xs file so that I am calling the same
underlying C API calls in the same order as the RabbitMQ C API (these
examples do compile and work).
Many Thanks
DazzaG