NAME
Crixa
VERSION
version 0.04
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.
WARNING
CRIXA IS ALPHA CODE. THE API MAY CHANGE.
One of the planned changes is to add asyncronous communication with RabbitMQ and that *may* involve a lot of changes.
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.
exchange(%args)
Return a newly configured exchange. This will autovivify a 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.