AMQP Architecture basics | Architecture of AMQP protocol
This page covers AMQP architecture basics.The architecture of AMQP consists of publishers, subscribers and a broker.
AMQP stands for Advanced Message Queuing Protocol. It is session layer protocol which runs over TCP layer. It is based on publish/subscribe architecture similar to MQTT protocol architecture.
AMQP does asynchronous transfer of messages regardless of OS, hardware ot programming language. It is advanced optimized on wire of data framing which has buffering approach that increases performances of server. It provides secured connection to users using TLS and SASL.
Figure: AMQP Architecture
The difference between MQTT and AMQP is that in AMQP broker is composed of two components viz. exchange and queues. Both exchange and queues are binded together.
In this architecture, client applications are known as producers ("publishers") while AMQP server is known as broker. Client apps create messages which are given to broker. In the broker, messages are routed and are queued. They are being read by consumers from the queues where they are processed. These client applications are known as consumers ("subscribers").
Exchange: This is the place where publishers deliver messages.
The messages contain routing keys which are used by "exchange" module
in order to route them (i.e. messages).
There are different types of exchange methods viz.
default, direct exchange, fanout exchange, topic exchange and header exchange.
Queues: These are the places where messages are stored until they are delivered to or read by subscribers.
Default exchange : Routing message to a queue (routing key = name queue)
Direct exchange : Routing message to a queue based on routing key (not necessary queue name, routing key = bind key)
Fanout exchange : Routing message to more queue (publish/subscribe) and not use a routing key
Topic exchange : Routing message to a queue based on routing key like a topic (routing key match a pattern)
Header exchange : Routing message to queue based on header filters
The basic unit of data in AMQP is a frame. They are used to initiate, control and tear down the transfer of messages between two peers.
These nine AMQP frame bodies are as follows :
1. open (the connection) 2. begin (the session) 3. attach (the link) 4. transfer 5. flow 6. disposition 7. detach (the link) 8. end (the session) 9. close (the connection)