Saturday, January 30, 2016

AMQP Essentials

WHAT IS AMQP?
AMQP (Advanced Message Queuing Protocol) is a binary transfer protocol that was made for enterprise applications and server-to-server communication (e.g., for financial businesses), but today it can be very useful in the Internet of Things world, thanks to the following primary features. AMQP is binary and avoids a lot of the useless data sent on the wire when using a text-based protocol like HTTP; because of this, it can be considered compact, too. Thanks to its multiplexed nature, only one connection (over a reliable stream transport protocol) is needed to allow separated data flows between the two peers; and of course it’s symmetric and provides both a client-server communication style and peer-to-peer exchange. Finally, it’s secure and reliable, providing three different levels of QoS (Quality of Service).
The last ratified version of AMQP (1.0) is the only one standardized by OASIS (since 2012/10) and ISO/IEC (since 2014/05), and it’s totally broker-model agnostic, as it doesn’t define any requirements on broker internals (this is the main difference with previous “not standard” versions like 0.9.1); the protocol is focused on how the data is transferred on the wire.

AMQP ARCHITECTURE
AMQP has a layered model defined in the following way from a bottom-up perspective:
• TRANSPORT/FRAMING:
Defines the connection behavior  and the security layer between peers on top of an underlying network transport protocol (TCP, for example). It also adds the framing protocol and how the exchanged data is formatted and encoded.
• MESSAGING:
Provides messaging capabilities at application level on top of the previous layer defining the message
entity as built of one or more frames.
Regarding the network transport layer, AMQP isn’t strongly tied to TCP, and as such can be used with any reliable stream transport protocol; so, for example, SCTP (Stream Control Transmission Protocol) and pipes are suitable.

AMQP COMMUNICATIONS
All the AMQP concepts—from connection, session, and link to performatives and messages—fit together to define how the communication happens between two peers. The main steps involved are:
• OPEN/CLOSE a connection (respectively after opening a network connection and before closing it) using “open” and “close” performatives
• BEGIN/END a session inside the connection thanks to “begin” and “end” performatives
• ATTACH/DETACH a link inside the session using “attach” and “detach” performatives
• SEND/RECEIVE messages with flow control thanks to “transfer, ” “disposition, ” and “flow” performatives

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.