logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Net::AMQP - Advanced Message Queue Protocol (de)serialization and representation

Amqp Versions

       AMQP 0-8 is fully supported.

       AMQP 0-9, 0-9-1, and 0-10 are usably supported.  There are interoperability issues with table encodings
       because the standard disagrees with the dialects of major implementations (RabbitMQ and Qpid).  For now,
       Net::AMQP limits itself to universally agreed table elements.  See
       <http://www.rabbitmq.com/amqp-0-9-1-errata.html> for details.

       AMQP 1.0 has not been tested.

Author

       Eric Waters <ewaters@gmail.com>

perl v5.40.1                                       2025-06-25                                     Net::AMQP(3pm)

Class Methods

parse_raw_frames
         Net::AMQP->parse_raw_frames(\$binary_payload)

       Given a scalar reference to a binary string, return a list of Net::AMQP::Frame objects, consuming the
       data in the string.  Croaks on invalid input.

Description

       This module implements the frame (de)serialization and representation of the Advanced Message Queue
       Protocol (http://www.amqp.org/).  It is to be used in conjunction with client or server software that
       does the actual TCP/IP communication.

Name

       Net::AMQP - Advanced Message Queue Protocol (de)serialization and representation

Quotes

       "All problems in computer science can be solved by another level of indirection." -- David Wheeler's
       observation

       "...except for the problem of too many layers of indirection." -- Kevlin Henney's corollary

See Also

       Net::AMQP::Value, Net::RabbitMQ, AnyEvent::RabbitMQ, Net::RabbitFoot, POE::Component::Client::AMQP

Synopsis

         use Net::AMQP;

         Net::AMQP::Protocol->load_xml_spec('amqp0-8.xml');

         ...

         my @frames = Net::AMQP->parse_raw_frames(\$input);

         ...

         foreach my $frame (@frames) {
             if ($frame->can('method_frame') && $frame->method_frame->isa('Net::AMQP::Protocol::Connection::Start')) {
                 my $output = Net::AMQP::Frame::Method->new(
                     channel => 0,
                     method_frame => Net::AMQP::Protocol::Connection::StartOk->new(
                         client_properties => { ... },
                         mechanism         => 'AMQPLAIN',
                         locale            => 'en_US',
                         response          => {
                             LOGIN    => 'guest',
                             PASSWORD => 'guest',
                         },
                     ),
                 );
                 print OUT $output->to_raw_frame();
             }
         }

Todo

       Address the dialect problem, either via modified spec files that completely control the wire protocol, or
       by programmatic request.  The former has precedent (viz "qpid.amqp0-8.xml" in spec), but could cause a
       combinatorial explosion as more brokers and versions are added.  The latter adds interface complexity.

See Also