Skip to content

Messaging Protocols

  • Messaging protocols define the rules and standards for exchanging messages between applications or services.
  • These protocols enable communication in distributed systems
  • ensure reliability, security, and efficiency.

1. Advanced Message Queuing Protocol (AMQP)

  • Description: A binary protocol designed for reliable and interoperable message queuing.
  • Key Features:
    • Supports message queuing, routing, and transactions.
    • Provides guaranteed delivery with acknowledgments.
    • Exchange types: Direct, Fanout, Topic, and Headers.
    • Supports persistent and transient messages.
  • Common Use Cases:
    • Financial transactions.
    • Distributed systems requiring reliability.
  • Supported by: RabbitMQ, Apache Qpid.

2. Message Queuing Telemetry Transport (MQTT)

  • Description: A lightweight protocol designed for resource-constrained devices and networks.
  • Key Features:
    • Publishes messages to topics with a "publish-subscribe" model.
    • Three levels of Quality of Service (QoS):
      1. At most once (fire-and-forget).
      2. At least once (guaranteed delivery with duplication possible).
      3. Exactly once (guaranteed no duplication).
    • Minimal bandwidth usage and overhead.
  • Common Use Cases:
    • IoT (Internet of Things).
    • Sensor data and telemetry.
  • Supported by: Mosquitto, HiveMQ, RabbitMQ (via plugin).

3. Streaming Text Oriented Messaging Protocol (STOMP)

  • Description: A simple, text-based protocol for message queuing.
  • Key Features:
    • Works with "subscribe" and "send" commands.
    • Operates over WebSocket for web applications.
    • Easy to implement but lacks advanced queuing features like AMQP.
  • Common Use Cases:
    • WebSocket-based messaging.
    • Chat applications.
  • Supported by: RabbitMQ, ActiveMQ.

4. Kafka Protocol

  • Description: A proprietary protocol designed for Apache Kafka, optimized for high-throughput, distributed messaging.
  • Key Features:
    • Designed for partitioned logs with message offsets.
    • Handles high-throughput real-time streaming.
    • Messages are persisted in a distributed, fault-tolerant manner.
  • Common Use Cases:
    • Event-driven architectures.
    • Real-time analytics.
    • Log aggregation.
  • Supported by: Apache Kafka.

5. HTTP/REST (Representational State Transfer)

  • check here : 04_REST.md 👈
  • Description: A stateless, text-based protocol commonly used for APIs.
  • Key Features:
    • Simple request-response model using HTTP verbs (GET, POST, PUT, DELETE).
    • Message formats: JSON or XML.
    • Easy integration with web applications.
  • Common Use Cases:
    • Web services and APIs.
    • Microservices communication.
  • Supported by: All modern web servers and clients.

6. Google Protocol Buffers (gRPC)

  • check here: 08_gRPC+webflux.md 👈
  • Description: A high-performance, open-source RPC framework by Google.
  • Key Features:
    • Uses Protocol Buffers (Protobuf) for serialization.
    • Supports bi-directional streaming.
    • Highly efficient binary format.
  • Common Use Cases:
    • Low-latency communication in microservices.
    • Distributed systems needing real-time communication.
  • Supported by: Google Cloud, gRPC libraries.

7 more (skip)

7.1. OpenWire

  • Description: A binary protocol used by Apache ActiveMQ for efficient message communication.
  • Key Features:
    • Optimized for ActiveMQ brokers.
    • High performance and compact.
  • Common Use Cases:
    • Applications built on ActiveMQ.
  • Supported by: Apache ActiveMQ.

7.2. Simple/Streaming Network Protocol (SNMP)

  • Description: A lightweight messaging protocol for network management.
  • Key Features:
    • Focused on telemetry and monitoring.
    • "Push" model for alerts.
    • Efficient in resource-constrained networks.
  • Common Use Cases:
    • IoT.
    • Network monitoring systems.
  • Supported by: RabbitMQ (via plugins), custom brokers.

7.3. ZeroMQ Protocol

  • Description: A high-performance messaging library for concurrency and distributed systems.
  • Key Features:
    • Offers multiple messaging patterns (Pub/Sub, Req/Rep, Push/Pull).
    • Operates over various transports (TCP, IPC, PGM).
    • No broker required (peer-to-peer).
  • Common Use Cases:
    • High-speed trading platforms.
    • Systems with custom messaging patterns.
  • Supported by: ZeroMQ library.

Key Differences Between Messaging Protocols

Protocol Binary/Text Pattern Reliability Use Cases Examples
AMQP Binary Queues/Exchanges High Reliable queuing RabbitMQ, Apache Qpid
MQTT Binary Pub/Sub Medium IoT, telemetry Mosquitto, HiveMQ
STOMP Text Pub/Sub Low WebSocket messaging RabbitMQ, ActiveMQ
Kafka Binary Partitioned Logs High Event streaming, analytics Apache Kafka
HTTP/REST Text Request-Response Medium APIs, web services All web servers
gRPC Binary RPC High Real-time microservices Google Cloud, Kubernetes
OpenWire Binary Queues/Topics Medium ActiveMQ-based applications Apache ActiveMQ
SNMP Binary Monitoring/Telemetry Medium IoT, monitoring RabbitMQ (via plugin)
ZeroMQ Binary Custom Patterns High Peer-to-peer communication ZeroMQ library