Chapter 2. How to speak Rabbit: the AMQ Protocol


This chapter covers

  • Communicating with RabbitMQ via the AMQ Protocol
  • Framing the AMQ Protocol at a low level
  • Publishing messages into RabbitMQ
  • Getting messages from RabbitMQ

The process that RabbitMQ and client libraries go through in order to get a message from your application into RabbitMQ and from RabbitMQ into consumer applications can be complex. If you’re processing critical information, such as sales data, reliably delivering the canonical source of information about the sale should be a top priority. At the protocol level, the AMQP specification defines the semantics for client and broker to negotiate and speak to each other about the process for relaying your information. Oftentimes the lexicon defined in the AMQP specification bubbles its way up into RabbitMQ client libraries, with the classes and methods used by applications communicating with RabbitMQ mirroring the protocol-level classes and methods. Understanding how this communication takes place will help you learn not just the “how” of communicating with RabbitMQ but also the “why.”

2.1. AMQP as an RPC transport

2.2. AMQP’s RPC frame structure

2.3. Putting the protocol to use

2.4. Writing a message publisher in Python

2.5. Getting messages from RabbitMQ

2.6. Summary