SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
A talk I held at perl mongers Wellington about RabbitMQ and Net::AMQP. A brief introduction to RabbitMQ and some basic code samples on how to use it from perl.
A talk I held at perl mongers Wellington about RabbitMQ and Net::AMQP. A brief introduction to RabbitMQ and some basic code samples on how to use it from perl.
22.
Net::AMQP::Simple::connect($spec);
Net::AMQP::Simple::pub( $queue, to_json($hash) );
Net::AMQP::Simple::queue( $uuid, 'autodelete' );
while ( !$done ) {
check( Net::AMQP::Simple::poll() );
}
sub check {
foreach my $_req (@_) {
my $req = from_json($_req);
print Dumper($req);
$done = 1;
}
}
23.
in plain english
• start a service that listens on a queue
• push a message to the service and tell the
service how to reply (if needed)
• listen on a temp queue for the response (if
needed)
24.
how to reply?
• use AMQP header fields
• roll your own protocol (JSON, XML, ...)
25.
... roll your own
if you want to use the full power of RabbitMQ
31.
credits
• the RabbitMQ guys for an awesome
product
• iWantMyName for letting me play with all
that stuff
• many guys on the mailing list for helping me
out when i got stuck
• Catalyst IT for the beers
32.
more credits
• http://www.ascii-art.com
• http://www.flickr.com/photos/revengingangel/
• http://www.flickr.com/photos/jeff62138/