NAME
AnyEvent::RabbitMQ - An asynchronous and multi channel Perl AMQP client.
SYNOPSIS
use
AnyEvent::RabbitMQ;
my
$cv
= AnyEvent->condvar;
my
$ar
= AnyEvent::RabbitMQ->new->load_xml_spec()->
connect
(
host
=>
'localhost'
,
port
=> 5672,
user
=>
'guest'
,
pass
=>
'guest'
,
vhost
=>
'/'
,
timeout
=> 1,
tls
=> 0,
# Or 1 if you'd like SSL
tls_ctx
=>
$anyevent_tls
# or a hash of AnyEvent::TLS options.
tune
=> {
heartbeat
=> 30,
channel_max
=>
$whatever
, frame_max =
$whatever
},
nodelay
=> 1,
# Reduces latency by disabling Nagle's algorithm
on_success
=>
sub
{
my
$ar
=
shift
;
$ar
->open_channel(
on_success
=>
sub
{
my
$channel
=
shift
;
$channel
->declare_exchange(
exchange
=>
'test_exchange'
,
on_success
=>
sub
{
$cv
->
send
(
'Declared exchange'
);
},
on_failure
=>
$cv
,
);
},
on_failure
=>
$cv
,
on_close
=>
sub
{
my
$method_frame
=
shift
->method_frame;
die
$method_frame
->reply_code,
$method_frame
->reply_text;
},
);
},
on_failure
=>
$cv
,
on_read_failure
=>
sub
{
die
@_
},
on_return
=>
sub
{
my
$frame
=
shift
;
die
"Unable to deliver "
, Dumper(
$frame
);
},
on_close
=>
sub
{
my
$why
=
shift
;
if
(
ref
(
$why
)) {
my
$method_frame
=
$why
->method_frame;
die
$method_frame
->reply_code,
": "
,
$method_frame
->reply_text;
}
else
{
die
$why
;
}
},
);
$cv
->
recv
,
"\n"
;
DESCRIPTION
AnyEvent::RabbitMQ is an AMQP(Advanced Message Queuing Protocol) client library, that is intended to allow you to interact with AMQP-compliant message brokers/servers such as RabbitMQ in an asynchronous fashion.
You can use AnyEvent::RabbitMQ to -
* Declare and
delete
exchanges
* Declare,
delete
,
bind
and unbind queues
* Set QoS and confirm mode
* Publish, consume, get, ack, recover and reject messages
* Select, commit and rollback transactions
Most of these actions can be done through AnyEvent::RabbitMQ::Channel. Please see the documentation there for more details.
AnyEvent::RabbitMQ is known to work with RabbitMQ versions 2.5.1 and versions 0-8 and 0-9-1 of the AMQP specification.
This client is the non-blocking version, for a blocking version with a similar API, see Net::RabbitFoot.
AUTHOR
Masahito Ikuta <cooldaemon@gmail.com>
MAINTAINER
Currently maintained by <bobtfish@bobtfish.net>
due to the original author being missing in action.
COPYRIGHT
Copyright (c) 2010, the above named author(s).
SEE ALSO
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.