NAME
Net::RabbitMQ::Simple - A simple syntax for Net::RabbitMQ
VERSION
This document describes NET::RabbitMQ::Simple version 0.0003.
SYNOPSIS
use Net::RabbitMQ::Simple;
mqconnect {
hostname => 'localhost',
user => 'guest',
password => 'guest',
vhost => '/'
};
exchange {
name => 'mtest_x',
type => 'direct',
passive => 0,
durable => 1,
auto_delete => 0,
exclusive => 0
};
publish {
exchange => 'maketest',
queue => 'mtest',
route => 'mtest_route',
message => 'message',
options => { content_type => 'text/plain' }
};
my $rv = consume;
# or
# my $rv = get { options => { routing_key => 'foo.*' }}
# use Data::Dumper;
# print Dumper($rv);
mqdisconnect;
DESCRIPTION
This package implements a simple syntax on top of Net::RabbitMQ. With the help of this package it is possible to write simple AMQP applications with a few lines of perl code.
METHODS
mqconnect
Connect to AMQP server using librabbitmq.
my $mq = mqconnect ({
user => 'guest'
password => 'guest',
vhost => '/',
channel_max => 0,
frame_max => 131072,
heartbeat => 0
});
exchange
Declare an exchange for work.
exchange {
name => 'name_of_exchange',
exchange_type => 'direct',
passive => 0,
durable => 0,
auto_delete => 1
};
exchange_delete
Delete an exchange if is possible.
exchange_delete {
name => 'name_of_exchange',
if_unused => 1,
nowait => 0
};
exchange_publish
Publish a new message.
publish {
exchange => 'exchange',
queue => 'queue',
route => 'route',
message => 'message',
options => { content_type => 'text/plain' }
};
consume
Consume messages from queue.
consume {
queue => 'name'
};
get
Consume messages from queue, but return undef if doesn't have message.
get {
queue => 'queue',
options => { routing_key => 'foo' }
};
SUPPORT
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
SEE ALSO
AUTHOR
Thiago Rondon. <thiago@aware.com.br>
LICENSE AND COPYRIGHT
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.