=head1 NAME Net::RabbitMQ::Simple - A simple syntax for Net::RabbitMQ =head1 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; =head1 DESCRIPTION This package implements a simple syntax on top of L. With the help of this package it is possible to write simple AMQP applications with a few lines of perl code. =head1 METHODS =cut =head2 mqconnect %hash Connect to AMQP server using librabbitmq. Return L object. { user => 'guest' password => 'guest', vhost => '/', channel_max => 0, frame_max => 131072, heartbeat => 0 } =cut =head2 exchange %hash Declare an exchange for work. { name => 'name_of_exchange', exchange_type => 'direct', passive => 0, durable => 0, auto_delete => 1 } =cut =head2 exchange_delete %hash Delete an exchange if is possible. exchange_delete { name => 'name_of_exchange', if_unused => 1, nowait => 0 } =cut =head2 exchange_publish %hash Publish a new message. { exchange => 'exchange', queue => 'queue', route => 'route', message => 'message', options => { content_type => 'text/plain' } } =cut =head2 consume %hash Consume messages from queue. { queue => 'name' } =cut =head2 get %hash Consume messages from queue, but return undef if doesn't have message. { queue => 'queue', options => { routing_key => 'foo' } } =cut =head2 tx Start a server-side transaction over channel. =cut =head2 commit Commit a server-side transaction over channel. =cut =head2 rollback Rollback a server-side transaction over channel. =cut =head2 purge Purge queue. =cut =head2 ack Need acknowledged. =cut =head2 mqdisconnect Disconnect from server. =cut =head2 mqobject $object Set current L object. =cut =head1 SUPPORT =over 4 =item * RT: CPAN's request tracker L =item * AnnoCPAN: Annotated CPAN documentation L =item * CPAN Ratings L =item * Search CPAN L =back =head1 SEE ALSO L, L =head1 AUTHOR Thiago Rondon. =head1 LICENSE AND COPYRIGHT This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =cut