AMQP

AMQP means Advanced Message Queuing Protocol. It is a protocol that is used for communication between two systems, which need to be loosely connected and potentially are heterogeneous.

What is a Message Queue?

When a subsystem (consumer) is dependent on some events occurring in some other subsystem (producer), we need to devise a way for communication between these two subsystems. IPC (Inter process communication) could be one such way, but it requires both the processes (subsystems) to run on same system. This is unlikely in distributed architecture and microservices architecture. As a result a mechanism has been devised where producer will post the events/outcome to a queue. This queue is then read by one ore more consumers. This is referred as Message Queue.

AMQP essentially allows two systems to communicate using Message Queues, but doesn’t put any dependency on the implementation of these systems. One system could be written in a C / C++ and other system could be a Java application. Such heterogeneous systems can comfortably communicate using AMQP. AMQP defines how a message should be constructed and sent over the wire, instead of defining how to implement producer and consumer. It is simply a byte stream across the network. Any consumer conforming to the data format can interpret the message. Hence this is also called as wire-level protocol.

Features of AMQP:

  • Message Orientation
  • Queuing
  • Routing
  • Reliability
  • Security

AMQP implementations allow routing such as point-to-point (one producer – one consumer) or publisher-subscriber model (one or more consumers can subscribe to messages from one or more publishers).

It is often easy to compare JMS (Java Messaging Service) with AMQP. The important difference is that JMS is an API, which defines implementation for producer and consumers, and hence it is tied with Java platform.

AMQP ensures the messages are delivered reliably and acknowledgement is obtained. Hence it forms an important aspect of the communication between producer and consumer.

A compelling example use case of Message Queue would be that of Food delivery ordering system. Typically such systems get loaded during meal hours and can’t afford to loose any orders due to errors. Posting the order data to message queue can ensure every order is processed.

Related Links:

Related Keywords

Software Architecture, AWS SQS, RabbitMQ, Apache Kafka

 

One Reply to “AMQP”

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.