RabbitMQ for Perl mongers

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Favorite

    RabbitMQ for Perl mongers - Presentation Transcript

    1. RabbitMQ for perl mongers
    2. __ / ` __ | ` /`/ _/` -"-/` / | | | (d b) _/ / ,".|.'._/.'.|.", / /' _|_ '/ | / '-`"`-' | | | | | | / / | jgs / / / `"` : /'"` `""`""`
    3. AMQP Advanced Message Queuing Protocol
    4. message flow in RabbitMQ
    5. RabbitMQ Exchange Queue Queue
    6. RabbitMQ RabbitMQ Queue
    7. RabbitMQ Queue
    8. AMQP XMPP STOMP HTTP RabbitMQ AMQP XMPP STOMP HTTP
    9. AMQP XMPP STOMP HTTP RabbitMQ AMQP XMPP STOMP HTTP AMQP XMPP STOMP HTTP RabbitMQ AMQP XMPP STOMP HTTP
    10. nice pictures but how does it look like?
    11. Net::AMQP(::Simple)
    12. boilerplate
    13. my $spec = { RemoteAddress => '127.0.0.1', RemotePort => { default => 5672 }, Username => { default => 'guest' }, Password => { default => 'guest' }, VirtualHost => { default => '/' }, Logger => 0, Debug => { default => {} }, Alias => { default => 'amqp_client' }, AliasTCP => { default => 'tcp_client' }, Callbacks => { default => {} }, channels => { default => {} }, is_started => { default => 0 }, };
    14. send a hash
    15. # conect to the server Net::AMQP::Simple::connect($spec); # push the message Net::AMQP::Simple::pub( $queue, to_json($hash) );
    16. receive a message
    17. while ( !$done ) { check( Net::AMQP::Simple::poll() ); } sub check { foreach my $_req (@_) { my $req = from_json($_req); print Dumper($req); $done = 1; } }
    18. typical messaging flow
    19. the “server”
    20. Net::AMQP::Simple::connect($spec); Net::AMQP::Simple::queue("web.domaindb.up"); while (1) { process( Net::AMQP::Simple::poll() ); } sub process { foreach my $_req (@_) { my $req = from_json( $_req, { allow_nonref => 1 } ); ... }
    21. the “client”
    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
    26. AMQP XMPP STOMP HTTP RabbitMQ AMQP XMPP STOMP HTTP
    27. how to get started?
    28. • http://rabbitmq.com (get rabbit here) • http://github.com/norbu09/ • net_amqp (has the Simple.pm) • RabbitIntro (some samples) • Net_RabbitMQ_HTTP
    29. or ask me lenz@ideegeo.com @norbu09
    30. thanks
    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/

    + Lenz GschwendtnerLenz Gschwendtner, 2 months ago

    custom

    417 views, 1 favs, 1 embeds more stats

    A talk I held at perl mongers Wellington about Rabb more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 417
      • 411 on SlideShare
      • 6 from embeds
    • Comments 0
    • Favorites 1
    • Downloads 6
    Most viewed embeds
    • 6 views on http://norbu09.org

    more

    All embeds
    • 6 views on http://norbu09.org

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories