AnyEve...bbitMQ(3pm)

πŸ’– AnyEvent::RabbitMQ β€” the manual page, but make it a vibe πŸ’–

User Contributed Perl Documentation Β· AnyEvent::RabbitMQ(3pm)

okay bestie sit DOWN because we're talking about AnyEvent::RabbitMQ and she is that girl 🐰✨


🌸 NAME 🌸

AnyEvent::RabbitMQ β€” an asynchronous and multi channel Perl AMQP client. periodt. πŸ’…


✨ SYNOPSIS ✨

here's the whole flex, copied exactly because I do NOT play with code:

  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;
          }
      },
  );

  print $cv->recv, "\n";

look at all those callbacks. she's got layers, she's got depth, she's got $cv doing the heavy lifting πŸ˜­πŸ’–


πŸ¦‹ DESCRIPTION πŸ¦‹

so. AnyEvent::RabbitMQ is an AMQP β€” that's Advanced Message Queuing Protocol, iykyk β€” client library. her whole thing is letting you talk to AMQP-compliant message brokers/servers (think RabbitMQ) in an asynchronous fashion. no blocking, no waiting around, no sitting in the group chat wondering if he read your message. she's got things to do πŸ’…

here's what you can use AnyEvent::RabbitMQ for:

  • 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. go read the docs over there for more details, bestie, she has her own lore πŸ“–βœ¨

AnyEvent::RabbitMQ is known to work with RabbitMQ versions 2.5.1 and versions 0-8 and 0-9-1 of the AMQP specification. receipts on the table πŸ”₯

this client is the non-blocking version. if you want a blocking version with a similar API, go see Net::RabbitFoot. different girl, similar energy 🫢


πŸ‘‘ AUTHOR πŸ‘‘

Masahito Ikuta <cooldaemon@gmail.com> β€” the original icon, we thank her for her service πŸŽ€


🧚 MAINTAINER 🧚

currently maintained by <bobtfish@bobtfish.net> β€” and the reason is genuinely kind of funny-slash-tragic: the original author is missing in action πŸ’€ like, MIA. gone. so bobtfish stepped up and is holding the line now. main character energy fr fr 🌈


Copyright (c) 2010, the above named author(s). πŸ“œ


πŸ“ SEE ALSO πŸ“

(yes bestie, this section is literally empty in the original. I'm not inventing links. I would never. the void is the vibe πŸ™ˆ)


πŸ’œ LICENSE πŸ’œ

this library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. slay, open source queen 🫢✨


πŸ’€ quick reminder before you go: I kept every option, flag, default, path, exit status, signal, error, example, warning, author, copyright and license line exactly as they were. the vibes are mine, the facts are hers. no cap.

and that's the whole page, bestie!! this was written for perl v5.32.1 and dated 2021-09-12 β€” so yeah, a lil vintage, a lil retro, still absolutely iconic πŸŽ€πŸ’– go forth and be asynchronous βœ¨πŸ¦‹

πŸ“¦ where this page comes from