Message Queues & Pub/Sub Simulator — Competing Consumers, Fan-Out & Redelivery

Interactive message queue simulator — publish messages through an exchange to competing consumers or fan-out subscriptions, lose an acknowledgment, and see redelivery repeat a side effect.

← Cloud Computing Labs
About this tool — how it works & FAQOpen ▾Close ▴

About the Message Queues & Pub/Sub Simulator

This simulator shows what happens between a publisher and its consumers. Messages pass through an exchange into queue slots, consumers take them, process them and acknowledge. You switch between a work queue and fan-out, slow the consumers, and lose an acknowledgment to watch the same message arrive twice.

What the simulator shows

• A 3D scene with a publisher and exchange, ready delivery slots, Consumer 1, Consumer 2, and an acknowledgment and retry path. • Controls for the delivery topology (one queue with competing consumers, or fan-out with one queue per subscriber), publication rate (0.5 to 3 messages per second), processing time (0.5 to 3 seconds), a switch that loses the first acknowledgment for every fourth message, and a Consumer 2 unavailable switch. • Readouts for original publications, ready message copies, unacknowledged copies, acknowledged copies, repeated side effects and dead-lettered or overflow copies. • Experiments for competing consumers, fan-out subscriptions and a lost acknowledgment.

Work queues, fan-out and redelivery

In the competing-consumers topology each work item is taken and acknowledged by exactly one consumer, so adding a consumer shares the work. In fan-out, each original publication creates one copy per subscriber, so copies equal two times the original publications. The accounting identity is produced copies equals acknowledged plus ready plus in flight plus dead-lettered. When the first acknowledgment is lost, the same copy is requeued and delivered again; because the handler already completed, the side effect repeats and the repeated-side-effects count rises — which is why consumers should be idempotent.

What the model is and is not

Delivery is deterministic, in-memory and FIFO with one in-flight item per consumer, with no durable disk storage or publisher confirms. A lost acknowledgment is represented as a requeue at handler completion, not a production timeout. Side effects are intentionally non-idempotent so the duplicates are visible. It is a pattern demonstrator, not a model of a specific broker.

Frequently asked questions

Does redelivery guarantee exactly-once side effects?

No. A handler may have completed its work before its acknowledgment was lost, so redelivery runs it again. The repeated side effects readout counts exactly this, and it is why idempotent handlers matter.

What is the difference between competing consumers and fan-out?

With competing consumers, one queue feeds both consumers and each message is processed by only one. With fan-out, each subscriber has its own queue and every original message is copied to each, so both consumers see all messages.

What happens when Consumer 2 is unavailable?

Its share of work is not processed. In the competing-consumers topology Consumer 1 must carry the load; in fan-out its queue backs up and copies stay ready or overflow, which shows up in the ready and dead-lettered readouts.

Why do produced copies differ from original publications?

Because fan-out creates a copy for each subscriber, and redelivery requeues the same copy. The lab tracks both: original publications count messages, while the copy counters track what is acknowledged, ready, in flight or dead-lettered.

Related tools & guides