Skip to main content
InterviewHubPRO
Section Overview
Q9

Question 9 of 50

Part 1: Foundational Distributed Systems Concepts & Trade-offs (1 - 10)

18%
System Design & Scalability (50 Qs)•Part 1: Foundational Distributed Systems Concepts & Trade-offs (1 - 10)

Message Brokers vs Event Streaming: RabbitMQ vs Apache Kafka.

senior LevelMost AskedCode ExampleDiagramSystem DesignRabbitMQApache Kafka

In Simple Words:

  • Message Broker (RabbitMQ):
    • Smart broker, dumb consumer model.
    • Messages are pushed to consumers via AMQP.
    • Once acknowledged (ACK), messages are deleted from the broker.
    • Ideal for task distribution, background job processing, and granular routing keys.
  • Distributed Event Stream (Apache Kafka):
    • Dumb broker, smart consumer model.
    • Append-only partitioned commit log stored on disk.
    • Messages are persisted for a configurable retention period (e.g. 7 days) regardless of consumption.
    • Consumers track their own read pointer (Offset). Multiple independent consumer groups can read the stream at different speeds and replay past events.
Architecture Flowchart
flowchart LR
    subgraph KafkaCluster["Apache Kafka (Log-Centric Streaming)"]
        P0["Partition 0 [Offset 0, 1, 2, 3...]"]
        P1["Partition 1 [Offset 0, 1, 2, 3...]"]
        P2["Partition 2 [Offset 0, 1, 2, 3...]"]
    end

    Producer["Order Service Producer"] -->|Partition Key: orderId| KafkaCluster
    KafkaCluster -->|Consumer Group A (Offset 3)| Billing["Billing Consumer"]
    KafkaCluster -->|Consumer Group B (Offset 1)| Fraud["Fraud Detection Engine"]
    KafkaCluster -->|Consumer Group C (Replay)| Analytics["Data Warehouse Sync"]