Professional IoT solution equipment supplier

Internet of Things Communication Protocol – AMQP

Custom Solutions 2022-09-29 71 views

Overview

AMQP (Advanced Message Queuing Protocol) is a network protocol for transmitting asynchronous messages between processes and an open standard for application layer protocols. Clients and message middleware based on this protocol can exchange messages, unrestricted by factors such as different products or programming languages of the client/middleware. The key features of AMQP are message orientation, queuing, routing (including point-to-point and publish/subscribe), reliability, and security. AMQP mandates the behavior of message providers and clients, enabling true interoperability among products from different companies and vendors.

AMQP is an open internet protocol standard for message queue communication.
  • Organization – Applications across different organizations
  • Technology – Applications on different platforms
  • Time – Systems do not need to be simultaneously available
  • Space – Operates reliably over long distances or on poor-quality networks

Development History

Message Queue originated from the vision of Vivek Ranadivé, a hardware design educator from MIT, who conceived a universal software bus, similar to a motherboard bus, for other applications to connect to. Vivek founded Teknekron in 1983. Companies like Goldman Sachs, as first users, adopted Teknekron's software in financial transactions, leading to the birth of the first-generation message queue software: Teknekron's The Information Bus (TIB).

Teknekron's TIB allowed application developers to establish a set of rules to describe message content. As long as messages were published according to these rules, any consumer application could subscribe to content of interest. Information producers and consumers were completely decoupled and could be flexibly mixed during transmission. This feature attracted attention from the telecommunications industry, particularly news agencies. Reuters acquired Teknekron in 1994.

Due to the positive reception of message queues in financial transactions, IBM also began developing its own message queue software (IBM MQ) in 1990, which gradually evolved into WebSphere MQ and dominated the commercial message queue platform market. Meanwhile, Microsoft developed Microsoft Message Queue (MSMQ). However, MQs from different vendors could not interoperate. To address this, Java Message Service (JMS) was born in 2001, attempting to hide the actual interfaces provided by various MQ vendors by offering a common Java API, thereby overcoming barriers and solving interoperability issues. However, using a single standardized interface to glue together many different interfaces made applications more fragile instead.

In 2004, JPMorgan Chase collaborated with iMatix Corporation to develop the Advanced Message Queuing Protocol (AMQP). It was designed from the outset as an open standard that anyone could implement, allowing anyone to interact with any MQ server provided by an AMQP vendor. In 2007, Rabbit Technologies released RabbitMQ 1.0, developed based on the AMQP standard.

AMQP Protocol

A client sends a message to an exchange. The exchange distributes copies of the message to queues based on rules defined by the exchange type and the routing key provided in the message. The message is ultimately consumed by subscribers.

Message Queue

A queue acts as a buffer for storing messages for later use. Many properties can be declared for a queue during its creation. For example, it can be marked as durable, auto-delete, and exclusive, where exclusive means it can only be used by one connection and will be deleted when that connection closes.

Exchanges and Exchange Types

A channel routes messages to queues based on the exchange type and the bindings between the exchange and queues. For a queue to receive messages, it must be bound to at least one exchange. AMQP 0.9.1 brokers should provide four exchange types – direct, fanout, topic, and headers exchanges. Many properties can be declared for an exchange during its creation. For example, it can be marked as durable to survive broker restarts, or as auto-delete, meaning it will be automatically deleted when the last queue is unbound.

Binding

A binding is a relationship between a queue and an exchange, defined by a set of rules (among others) used by the exchange to route messages to the queue.

Message and Content

A message is the entity sent from a publisher to a queue and ultimately consumed by a subscriber. Each message contains a set of headers defining properties such as lifetime, durability, and priority. AMQP 0.9.1 also has a built-in feature called message acknowledgments for confirming message delivery and/or processing.

Connection

A connection in AMQP 0.9.1 is a network link between an application and an AMQP broker, such as a TCP/IP socket connection.

Channel

A channel is a virtual connection within a connection, existing between two AMQP peers. Publishing messages to a queue or consuming messages from a queue is performed through a channel. A channel is multiplexed, meaning a single connection can have multiple channels.

Virtual Hosts

A virtual host (vhost) provides a way to isolate applications within a broker. Different users can have different access permissions to different virtual hosts. When queues and exchanges are created, they exist within only one virtual host.

AMQP Methods

AMQP 0.9.1 provides numerous methods or operations that can be performed. Examples of AMQP methods include opening a channel, declaring a queue, or deleting an exchange (channel.open, queue.declare, or exchange.delete-ok).

AMQP vs MQTT

Although AMQP and MQTT differ significantly in architecture and protocol, they are widely used in various applications, including the Internet of Things (IoT). As open-source protocols, both AMQP and MQTT can be used across all applications based on client requirements and available bandwidth.

ItemAMQPMQTT
DefinitionAMQP stands for Advanced Message Queuing Protocol. It provides a richer messaging environment.MQTT is defined as Message Queuing Telemetry Transport. It offers a simple way of message queuing service and is primarily implemented in embedded systems.
BackgroundAMQP was developed by a financial group as an open-source, customer-driven queue. It is improved daily in the market without any customization.MQTT is largely vendor-driven, developed by IBM, and has high implementation costs.
ProtocolAMQP uses TCP for asynchronous message transmission, regardless of any choice of OS, hardware, or programming language. It provides a fully-featured messaging service. AMQP operates among parties under various controls of network users and infrastructure resources.Similar to AMQP, MQTT uses TCP to share messages asynchronously, independent of any attributes. It is designed for small devices operating on minimal network bandwidth. MQTT assumes intricate parties are managed by nearby private infrastructure.
Architecture OptimizationIt features advanced optimization on data framing lines with buffering methods that enhance server performance.This framework uses a stream-like approach for framing on minimal storage devices. It does not allow bulk message transmission.
Message ServiceAMQP applies five different properties, such as publisher-subscriber unaffected lifetime, staying in the queue as long as needed, remaining idle if no one is using the queue. It supports various messaging round-robin mechanisms, classic or traditional message queues, combinations, and store-and-forward. It implements metadata messages to aid idempotent messaging and message grouping.Based on publish/subscribe messaging concerning content and is highly transient. It is mainly used for actively routing linked subscribers and publishers. It is limited to applying traditional extended-lifetime message queues.
Message ProcessingIt supports different acknowledgments, transactions, use cases, and the entire message queue. It can decompose various transaction codes as required and confirm expiration in the presence of latency to fine-tune performance.MQTT does not support any type of message processing, only acknowledgments.
Connection SecurityAMQP utilizes SASL methods to select security without changing the protocol. It provides distinct names for components within the same network. This feature enables the use of nested firewalls and gatekeepers. It authenticates users before broadcasting any message.MQTT requires a small username and password and does not set any preventive measures during this process.
Last Value QueueIt does not support the last value in a queue.It provides the Retain command and supports the last value in a queue.
Namespace in MessagesIt allows multiple ways to locate messages, such as by node and queue.It uses "namespaces" in the hierarchical transmission of messages.
AMQP vs MQTT
Editor-in-Chief:

Content Reviewer:
online_customer_service
welcome_to_customer_service