tags : Distributed Systems, Inter Process Communication, Concurrency

In my experience of reading articles and discussions related to Message Passing, it’s apparent that the terms are not used very consistently. So don’t make the mistake of being too pedantic about these terms, esp technologies.

Important references

Messaging Patterns

Direct to Endpoint

Issues with DoE

  • So basically there are tradefoffs
  • Retry logic: in the event of failed consumers/slow consumers
  • What guarantees that service is reachable and working as intended?
  • Guaranteed delivery?
  • What if a lot of systems want to be listening, you’ll have to bake in that logic into the producer. Non-DOE systems help decouple this.

Pub/sub

  • Multiple subscribers can consume the same message from the same topic.

Queue (See Message Queue)

  • For multiple consumers, we need to set up separate queues. Different implementations have different ways of making this happen.

Message Queue (MQ)

Implementations

Different implementations have different tradefoff, I am just listing random things. Analyze the situation at hand and decide for yourself. Different implementations can support/not support different message passing patterns.

Brokerless

ZMQ (ZeroMQ)

  • zmq is a communication library, not an application.
  • Also useful for communications between services on single server
  • It’s like sockets on steroids.

NanoMQ

Original Nanomsg is abandoned. There’s nng which is a lightweight, broker-less library. People on the internet say it’s inferior to ZMQ.

Broker

RabbitMQ

  • A message router but can be tricky to administer.
  • Supported protocols: AMQP, HTTP, WS, STOMP, MQTT
  • Has 1:1, 1:N and others
  • Good
    • if retention and streaming is not a requirement (confusing)
    • For long-running tasks
    • A needs to notify another B about something
  • Cautionary Tales

Redis

  • See Redis
  • The message queue/ pub sub feature of Redis is a secondary use case. Hence, abilities are simpler than RabbitMQ.
  • But it can be used as a message queue

Others

  • ActiveMQ
  • SQS/SNS
  • Google Pub/Sub

Distributed Broker

Kafka

  • See Kafka
  • It’s an event stream processing software/distributed log.
  • It is used to stream data in the order it arrives, effectively, in a fault tolerant way.
  • It has disk persistence, but not designed for zero data loss
  • Misconceptions
    • It’s a broker, not a data lake. (Not designed to batch loads at all times, will affect processing)
    • Your app doesn’t have to be a collection of microservices in order to use Kafka. One can apply CQRS using Kafka on a monolith application but it’s usually done to eventually move towards microservices architecture.
    • Not a message queue

Pulsar

  • Supports all of the messaging patterns such as streaming, pubsub, and queues (Kafka doesn’t support certain queue patterns).

NATS

  • Started as high performance pub/sub
  • Now a Kafka competitor w Jetstream(persistent log streams)

NSQ

Others

Protocol

See Custom Protocols

AMQP

MQTT (Protocol)

  • Lightweight message queue protocol especially for embedded devices
  • A pub/sub platform