NAME
Crixa
VERSION
version 0.01
SYNOPSIS
use Crixa;
my $mq = Crixa->connect( host => 'localhost');
sub send {
my $q = $mq->queue( name => 'hello');
$q->publish('Hello World');
}
sub receive {
my $q = $mq->queue( name => 'hello');
$q->handle_message(sub { say $_->{body} });
}
DESCRIPTION
All the world will be your enemy, Prince of a Thousand enemies. And when
they catch you, they will kill you. But first they must catch you; digger,
listener, runner, Prince with the swift warning. Be cunning, and full of
tricks, and your people will never be destroyed. -- Richard Adams
The RabbitMQ docs use Python's Pika library for most of their examples. When I was translating the tutorial examples to Perl so I could get a grasp on how different ideas would translate I found myself disliking the default Net::RabbitMQ API. That isn't to say it's bad, just really bare bones. So I went and wrote the API I wanted to use, influenced by he Pika examples.
ATTRIBUTES
host (required)
The host with the RabbitMQ instance to connect to.
user
A user name to connect with.
password
The password for the (optional) username.
METHODS
connect
Create a new connection to a RabbitMQ server. It takes a hash or hashref of named parameters.
- host => $hostname
-
A required hostname to connect to.
- user => $user
-
An optional username.
- password => $password
-
An optional password.
channel ($id | \%args )
Return the channel associated with $id
. If $id
isn't defined it returns a newly created channel.
queue(%args)
Return a newly configured queue, this will autovivify a channel.
disconnect
Disconnect from the server. This is called implicitly by DEMOLISH
so normally there should be no need to do this explicitly.