Comparison of three messaging brokers side-by-side: Kafka (log-based, partitioned, dumb broker + smart consumer with offset tracking), RabbitMQ (smart broker with topic exchange routing to multiple queues, push delivery, DLX for rejects), and Pulsar (stateless broker + Apache BookKeeper segmented storage with E=3/W=2/A=2 quorum, tiered S3 offload for cold segments, multiple subscription types). Includes 4 scenarios: Kafka log fan-out via consumer groups with replay, RabbitMQ topic exchange routing with DLX, Pulsar segmented storage and broker failover, and ADR decision matrix walkthrough.
Нельзя сравнивать brokers одной строкой «Kafka = streaming, RabbitMQ = queue, Pulsar = оба». Нужно сопоставлять exact workload contract: routing, replay, consumer coordination, storage, ack и failure recovery.
| Компонент | Ответственность |
|---|---|
| Publisher | Выбирает message key/id и ждёт documented broker acknowledgement. |
| Kafka Partitioned Log | Хранит ordered offsets per partition и consumer-group positions. |
| Kafka Group Consumer | Подключается к broker, обрабатывает assigned partitions и commits offsets. |
| RabbitMQ Exchange and Queue | Exchange routes; queue delivers with manual/auto acknowledgement policy. |
| RabbitMQ Consumer | Подключается к queue, ACK/NACK и готов к redelivery. |
| Pulsar Broker and Topic | Обслуживает producers/consumers и subscription cursors. |
| BookKeeper Storage | Durable ledger storage behind Pulsar brokers. |
| Pulsar Subscription Consumer | Подключается к named subscription with exclusive/shared/failover/key_shared semantics. |
Records are ordered within each partition. A group assigns a partition to one consumer at a time; processing then offset commit yields at-least-once on crash unless a scoped transaction/idempotent sink closes the boundary.
Проверяемый исход: Retention and auto.offset.reset are configured; auto.offset.reset is only used when no valid committed offset exists.
Publisher confirms cover publisher-to-broker acceptance; consumer acknowledgements independently cover delivery processing. Exchanges route into queues; unacked messages can be requeued on connection loss.
Проверяемый исход: Consumer handles redelivery idempotently and caps poison-message loops with dead-letter/backoff policy.
A broker appends to BookKeeper and tracks a named subscription cursor. Subscription type determines distribution/ordering behavior; no invented E/W/A quorum formula is treated as a universal application guarantee.
Проверяемый исход: A broker failover can reconnect clients to durable ledgers; consumers still handle redelivery and cursor semantics.
All three paths can redeliver or expose ambiguous publish outcomes depending on where failure happens. The application needs stable message IDs, bounded retries and reconciliation.
Проверяемый исход: The choice table records workload/failure assumptions, not universal latency or durability rankings.
Числа выше — учебные inputs или размерностные формулы. Их нельзя выдавать за benchmark или SLA конкретного продукта.
[CONCEPT]exactly-once-semantics
Диаграмма показывает причинные границы и recovery contracts, а не скрытую реализацию конкретного managed-сервиса. Любая stronger guarantee действует только в явно названной transaction/checkpoint/acknowledgement boundary.
Введите числа или выберите пресет