Message Queue
Message queues provide an
asynchronous communications protocol, meaning that the sender and receiver of the message do not need to interact with the message queue at the same time.
Most messaging systems support both the
publisher/subscriberand message queue models in their API
Features of Message Queue
Messages are queued asynchronously between applications and systems.
- Multiple
providerscanpost messagesto a queue - There can be multiple message
consumersattached to asingle queue - The queuing infrastructure ensures messages are delivered
exactly once - Messages can be
successfully submittedto a queue even if the message consumer(s) for that queue are not running or areunreachable
Benefits
ScalabilityReliabilityAbstractionsince producers and consumers aren’t directly interconnected
Implementation
There are a number of open source choices of messaging middleware systems, including Apache
ActiveMQ, ApacheKafka, ApacheRocketMQ,RabbitMQ, etc.
JMS VS AMQP
JMS
The
Java Message Service(JMS) API is aJavaMessage Oriented Middleware (MOM) API for sending messages betweentwo or more clients. JMS is a part of theJava Platform. It is amessaging standardthat allows application components based on the Java Enterprise Edition (Java EE) to create, send, receive, and read messages. It allows the communication between different components of a distributed application to beloosely coupled,reliable, andasynchronous.AMQP
The
Advanced Message Queuing Protocol(AMQP) is anopen standardwire-level protocolfor message-oriented middleware. The defining features of AMQP aremessage orientation,queuing,routing(includingpoint-to-pointandpublish-and-subscribe`), reliability and security.
JMS is
APIand AMQP is aprotocol. JMS is only a API spec. It doesn’t use any protocol. AJMS provider(like ActiveMQ) could be using any underlying protocol to realize the JMS API.
ActiveMQ vs RabbitMQ vs Kafka
- Throughput
Kafka > RabbitMQ > ActiveMQ
- Latency
RabbitMQ(Erlang) < Kafka(Scala&Java) < ActiveMQ(Java)
- Infrastructure
RabbitMQ(AMQP, Distributed Platform)
Kafka(Distributed streaming platform)
ActiveMQ(JMS)