Independent ActiveMQ handbook · archive of the 2004–2007 project site
Independent guide. Not the Apache ActiveMQ project site and not affiliated with the Apache Software Foundation. ActiveMQ and Apache are trademarks of the ASF. Official documentation: activemq.apache.org.

activemq.org › Handbook › AMQP: 0-9-1 vs 1.0, and which brokers speak which

Handbook

AMQP: 0-9-1 vs 1.0, and which brokers speak which

Checked against ActiveMQ Classic 6.4.0, 6.3.3 and 5.19.12 and Apache Artemis 2.57.0 on . Independent guide; sources are listed at the end. Official documentation: activemq.apache.org and artemis.apache.org.

AMQP, the Advanced Message Queuing Protocol, is an open wire-level protocol for messaging, but the name covers two different protocols. AMQP 0-9-1 defines a broker model of exchanges, queues and bindings, the model RabbitMQ implements; AMQP 1.0 is an OASIS and ISO/IEC standard that defines a symmetric protocol for exchanging messages between two parties. They are not two versions of one protocol: when a client connects, the protocol header it sends says which of the two it wants.

ActiveMQ Classic and Apache Artemis (formerly ActiveMQ Artemis) implement AMQP 1.0. RabbitMQ speaks both, and has supported AMQP 1.0 natively since RabbitMQ 4.0. This page compares the two protocols, shows which broker speaks which, and covers the AMQP connector and port 5672 in each broker. The official ActiveMQ documentation is on activemq.apache.org, and Artemis's is on artemis.apache.org.

What is AMQP?

The AMQP 1.0 specification describes AMQP as an open internet protocol for business messaging: a binary wire-level protocol for the reliable exchange of messages between two parties. AMQP 1.0 became an OASIS Standard on 29 October 2012 and is also the international standard ISO/IEC 19464. Its specification is layered in parts: the type system and encoding, the transport, messaging, transactions, and security.

AMQP 0-9-1, in RabbitMQ's words, is not an official standard. RabbitMQ's documentation describes it as a protocol that lets conforming client applications communicate with conforming messaging brokers, and it spells out how those brokers route messages.

AMQP 0-9-1 vs AMQP 1.0: two different protocols

The difference is not a version bump. AMQP 0-9-1 describes a broker and what lives inside it. Publishers send messages to exchanges; exchanges route copies to queues according to rules called bindings; consumers read from queues. Applications themselves, not a broker administrator, mostly define these entities and the routing, which is why RabbitMQ calls 0-9-1 a programmable protocol. It defines four exchange types: direct, fanout, topic and headers.

AMQP 1.0 works differently. The specification says it makes no wire-level distinction between clients and brokers: the protocol is symmetric. Messages travel over links, and an address says where a message is sent to or consumed from. What an address refers to inside a broker, and how it is resolved, is left to each implementation, so different AMQP 1.0 brokers can interpret the same address differently.

AMQP 0-9-1AMQP 1.0
Standard statusNot an official standardOASIS Standard (2012) and ISO/IEC 19464
What it definesA broker model: exchanges, queues and bindings, declared by applicationsA symmetric transport and message format; the broker's internal model is up to the implementation
Where messages are sentTo an exchange, with a routing keyTo an address on a link; each broker defines its address syntax
Connection startClient sends a protocol header asking for 0-9-1Client sends a protocol header asking for 1.0
Port5672 on RabbitMQ, shared with 1.05672 on ActiveMQ Classic (once enabled), Artemis and RabbitMQ
BrokersRabbitMQActiveMQ Classic, Apache Artemis, RabbitMQ

The protocol header is where the two part ways. Before sending any AMQP frames, the client announces which protocol it wants, and RabbitMQ uses that header to decide whether a connection on port 5672 is AMQP 1.0 or 0-9-1. ActiveMQ Classic and Artemis document AMQP 1.0 only, so an AMQP 0-9-1 client library is the wrong tool for them.

Which brokers speak which AMQP?

BrokerAMQP 0-9-1AMQP 1.0Port
ActiveMQ ClassicNot documentedYes, since 5.85672 once the amqp transport connector is uncommented; it is commented out in the default configuration of 6.4.0 and 5.19.12
Apache ArtemisNot documentedYes5672 and 61616 by default
RabbitMQYesYes, natively since 4.05672 for both

RabbitMQ's documentation recommends AMQP 1.0 for new applications and notes that more brokers support AMQP 1.0 than 0-9-1. For a wider comparison of the brokers themselves, see ActiveMQ vs RabbitMQ and ActiveMQ Classic vs Artemis.

AMQP in ActiveMQ Classic

ActiveMQ supports AMQP 1.0 from version 5.8. You enable it with a transport connector whose URI uses the amqp scheme. From the ActiveMQ Classic AMQP documentation, which applies to ActiveMQ 5.8 and later:

<transportConnectors>
   <transportConnector name="amqp" uri="amqp://0.0.0.0:5672"/>
</transportConnectors>

The ActiveMQ AMQP page says this connector is enabled in the default server configuration. In the conf/activemq.xml shipped with ActiveMQ 6.4.0, and in the one shipped with 5.19.12, it is not: only the OpenWire connector on 61616 is enabled, and the AMQP line is commented out under a note that additional transports are disabled by default to reduce the exposed attack surface. Clients cannot connect on 5672 until you enable it. The line as it appears in both files:

<!-- <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=10485760"/> -->

Uncomment that line to accept AMQP clients on 5672. The shipped file recommends the secured variant, amqp+ssl, in production; the AMQP page's SSL example listens on 5671. For better scalability the documentation recommends amqp+nio instead of the default TCP transport; it generally uses far fewer threads than the standard connector. The full list of default ports is on ActiveMQ ports.

Other behavior documented for ActiveMQ Classic:

  • Authentication: the broker accepts SASL PLAIN, and authorization policies apply to destinations as usual.
  • Destinations: prefix the address with queue:// or topic://. Without a prefix, the destination is a queue.
  • Credit and prefetch: an AMQP receiver maps to a JMS consumer. The broker honors the credit the client grants, or uses 1000 if the client sets none; transport.prefetch on the connector overrides the client. The broker's own receiving link uses 1000 credits by default, changed with transport.producerCredit.
  • Mapping to JMS: the transport.transformer option chooses native (the default, which wraps the AMQP message bytes in a JMS BytesMessage and maps the headers), raw, or jms, which maps the AMQP body to the JMS body.
  • Client library: the AMQP page points to Apache Qpid Proton.

AMQP in Apache Artemis

Artemis supports the AMQP 1.0 specification. By default its configuration has acceptors that take AMQP connections on ports 61616 and 5672, and the documentation says any AMQP 1.0 client can be used, listing Qpid clients, .NET clients and the JavaScript client Rhea among others. Its Java example uses the Qpid JMS client.

Artemis accepts the PLAIN, ANONYMOUS and GSSAPI SASL mechanisms. It does not convert messages that arrive and leave over AMQP. AMQP itself has no notion of topics, so Artemis treats a receiving link that attaches to an address with only multicast enabled as a subscription. That is how AMQP clients consume publish/subscribe messages there.

AMQP in RabbitMQ

From the RabbitMQ 4.4 documentation:

  • AMQP 1.0 has been supported natively since RabbitMQ 4.0, and RabbitMQ supports both AMQP 1.0 and 0.9.1 out of the box, without plugins.
  • By default it listens on port 5672 for both protocols and tells them apart by the protocol header the client sends.
  • AMQP 1.0 connections must use SASL; RabbitMQ rejects a 1.0 client that does not.
  • AMQP 1.0 addresses map onto the 0-9-1 model. With address format v2, clients send to /exchanges/:exchange/:routing-key, /exchanges/:exchange or /queues/:queue, and consume from /queues/:queue. The older v1 format is deprecated since 4.0.
  • Some features exist only in 0-9-1. RabbitMQ gives 0-9-1 limited transaction support, while AMQP 1.0 currently does not support transactions there, and per-exchange and per-queue message rates in the management UI are shown only for 0-9-1 connections.

AMQP client libraries

Because AMQP 1.0 is a standard, an AMQP 1.0 client is not tied to one broker. RabbitMQ states that any AMQP 1.0 client should be able to communicate with it, and its team publishes AMQP 1.0 clients for Java and .NET. The ActiveMQ Classic documentation names Apache Qpid Proton, and the Artemis documentation uses the Qpid JMS client in its Java example. The RabbitMQ documentation also notes that the AMQP 0-9-1 client ecosystem is currently more extensive.

What does not carry over between brokers is the address syntax. ActiveMQ Classic expects queue:// and topic:// prefixes, while RabbitMQ's v2 format expects /queues/ and /exchanges/ paths, so plan to change addresses when you move an AMQP 1.0 application from one broker to another.

See also STOMP protocol.

Common problems

  • Connection refused on port 5672 against ActiveMQ Classic. The AMQP connector is commented out in the activemq.xml shipped with 6.4.0 and 5.19.12; uncomment it or add your own.
  • An AMQP 0-9-1 client cannot connect to ActiveMQ or Artemis. Both document AMQP 1.0 only. Use an AMQP 1.0 client.
  • Messages end up on a queue when you meant a topic in ActiveMQ Classic. Addresses without a prefix are queues; use topic://.
  • JMS consumers receive a BytesMessage instead of the expected body type. The default native transformer wraps the AMQP message in a BytesMessage; set transport.transformer=jms to map bodies.
  • RabbitMQ rejects an AMQP 1.0 connection. RabbitMQ requires SASL for AMQP 1.0.

Frequently asked questions

What is the difference between AMQP 0-9-1 and AMQP 1.0?

They are different protocols, not two versions of one. AMQP 0-9-1 defines a broker model of exchanges, queues and bindings that applications declare themselves, while AMQP 1.0 is an OASIS and ISO/IEC 19464 standard with a symmetric design that leaves what an address means inside a broker to each implementation. A client says which one it wants in the protocol header it sends when it connects.

Does ActiveMQ support AMQP?

Yes. ActiveMQ Classic supports AMQP 1.0 from version 5.8, and Apache Artemis supports AMQP 1.0 as well. Neither documents AMQP 0-9-1, so use an AMQP 1.0 client with them.

What port does AMQP use?

5672 in all three brokers covered here. In ActiveMQ Classic 6.4.0 and 5.19.12 the amqp connector on 5672 is commented out in the shipped conf/activemq.xml, so you must uncomment it before clients can connect. Artemis accepts AMQP on 5672 and 61616 by default, and RabbitMQ serves both AMQP 1.0 and 0-9-1 on 5672.

Does RabbitMQ support AMQP 1.0?

Yes. RabbitMQ has supported AMQP 1.0 natively since 4.0, without plugins, alongside AMQP 0-9-1. It requires SASL on AMQP 1.0 connections and recommends AMQP 1.0 for new applications.

Which AMQP client library should I use?

Any AMQP 1.0 client should work with an AMQP 1.0 broker. The ActiveMQ Classic documentation names Apache Qpid Proton, the Artemis documentation uses the Qpid JMS client in its Java example and lists Rhea for JavaScript, and the RabbitMQ team publishes AMQP 1.0 clients for Java and .NET. Expect to change address syntax between brokers.

Related guides

Sources

  1. OASIS AMQP 1.0 Part 0: Overview docs.oasis-open.org
  2. RabbitMQ: AMQP 1.0 www.rabbitmq.com
  3. RabbitMQ: AMQP 0-9-1 Model Explained www.rabbitmq.com
  4. ActiveMQ: AMQP activemq.apache.org
  5. ActiveMQ 6.4.0 default conf/activemq.xml raw.githubusercontent.com
  6. ActiveMQ 5.19.12 default conf/activemq.xml raw.githubusercontent.com
  7. Apache Artemis: AMQP artemis.apache.org
  8. Apache Artemis: News artemis.apache.org