AMQP
view release on metacpan or search on metacpan
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19xx name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the
appropriate parts of the General Public License. Of course, the
commands you use may be called something other than `show w' and `show
c'; they could even be mouse-clicks or menu items--whatever suits your
program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here a sample; alter the names:
lib/AMQP/Publisher.pm view on Meta::CPAN
has 'debug' => 1;
has 'host' => 'localhost';
has 'port' => 5672;
has 'user' => 'guest';
has 'password' => 'guest';
has 'vhost' => '/';
has 'timeout' => 1;
has 'heartbeat' => 30;
has 'exchange' => 'log';
has 'type' => 'topic';
has 'key' => '#';
has 'rabbit';
has 'connection';
has 'channel';
has 'status';
has 'on_connect';
sub attach {
my $self = shift;
$self->status(AnyEvent->condvar);
lib/AMQP/Publisher.pm view on Meta::CPAN
=head1 NAME
AMQP::Publisher -- Publishes messages to an exchange.
=head1 SYNOPSIS
use AMQP::Publisher;
my $publisher = AMQP::Publisher->new;
$publisher->server('amqp://foo:bar@localhost:5672/testing');
$publisher->exchange('test');
$publisher->type('topic');
$publisher->queue('testing');
$publisher->on_connect( sub {
my ($self) = @_;
$self->channel->send('hello world');
});
$publisher->attach;
=head1 DESCRIPTION
The AMQP::Publisher publishes messages to an AMQP exchange
lib/AMQP/Subscriber.pm view on Meta::CPAN
has 'debug' => 1;
has 'host' => 'localhost';
has 'port' => 5672;
has 'username' => 'guest';
has 'password' => 'guest';
has 'vhost' => '/';
has 'timeout' => 1;
has 'heartbeat' => 30;
has 'exchange' => 'test';
has 'type' => 'topic';
has 'key' => '#';
has 'queue' => 'test';
has 'rabbit';
has 'connection';
has 'channel';
has 'status';
has 'tag' => $ENV{LOGNAME} . "@" . hostname;
has 'on_message';
sub attach {
lib/AMQP/Subscriber.pm view on Meta::CPAN
on_failure => $self->status,
on_close => sub {
say "Channel closed" if $self->debug;
$self->status->send;
},
on_success => sub {
say "Opened channel" if $self->debug;
$self->channel(shift);
$self->channel->declare_exchange(
exchange => $self->exchange,
type => $self->type,
auto_delete => 1,
on_failure => $self->status,
on_success => sub {
say "Declared exchange " . $self->exchange if $self->debug;
$self->channel->declare_queue(
queue => $self->queue,
auto_delete => 1,
on_failure => $self->status,
on_success => sub {
say "Declared queue " . $self->queue if $self->debug;
lib/AMQP/Subscriber.pm view on Meta::CPAN
=head1 NAME
AMQP::Subscriber -- Listens for messages on a queue and does stuff with them.
=head1 SYNOPSIS
use AMQP::Subscriber;
my $subscriber = AMQP::Subscriber->new;
$subscriber->server('amqp://foo:bar@localhost:5672/testing');
$subscriber->exchange('test');
$subscriber->type('topic');
$subscriber->queue('testing');
$subscriber->callback( sub {
my ($self,$message) = @_;
say $message;
});
$subscriber->attach;
=head1 DESCRIPTION
The AMQP::Subscriber wraps
( run in 3.007 seconds using v1.01-cache-2.11-cpan-df04353d9ac )