jonnifyechomq

← the depth behind redis-patterns R5 · Streams & Events

The Bus · pillar II

Broadcast signals
over the wire

Fan a message out to everyone, then keep an ordered, replayable log of what was said.

The Bus is the second pillar, and it is the mirror of the Queue. Where the Queue hands one job to one worker, the Bus does the opposite: it broadcasts to everyone, and it keeps an append-only log many readers replay at their own pace. Two surfaces, one wire. Events (EchoMQ.Events) are fire-and-forget pub/sub — a consumer reacts to work as it happens without polling. The stream log (EchoMQ.Stream) is a retained, replayable log ordered by mint — consumed by groups at-least-once, read by a mint instant for time-travel, bounded by retention, and what it trims is folded into the durable floor. The thread through both is the branded id. It is all real code.

The two surfaces, one wire

The Bus is one wire read two ways. Events broadcast a signal to whoever is listening, now and gone. The stream is the same idea made durable: an append-only log, ordered the way the store is ordered — by the branded id — that survives, replays, and folds to disk. Pick a verb to read what it does, the Valkey command beneath it, and the guarantee it makes.

One wire, two reads · pick a verb

emq:{q}: — one owned wire publish PUBLISH sub sub sub EchoMQ.Events · at-most-once EchoMQ.Stream · ordered by mint EVT EVT EVT EVT EVT EVT EVT XADD head — oldest tail — append → consumer group XREADGROUP · at-least-once read by instant XRANGE [t0, t1] trim the head XTRIM MAXLEN / MINID the durable Graft floor StreamArchive.fold · CubDB → Tigris

One wire: events say it once, the stream remembers — appended in mint order, replayed by a group, read by an instant, trimmed by policy, and what is trimmed is folded, not lost.

The modules

Five modules, each a hub and three dives, then a workshop. Each grounds in the real echo/apps/echo_mq code — the events channel, the append-only log, consumer groups, the mint-instant read, and retention folding into the echo/apps/echo_store archive.

built page ready to read soon on the build front

Redis Patterns Applied

This is the depth behind the Redis Patterns Applied chapter that doors here: R5 · Streams & Events — the pub/sub events and the retained, replayable log that land in this pillar, and the stream patterns (the append-only log, consumer groups, event sourcing) this pillar's log makes concrete. There the pattern is the door; here is the wire.

The durable floor

A log that only grows is a leak, so retention is a policy — and what a stream trims is not lost. EchoStore.StreamArchive folds the trimmed segments into the durable EchoStore.Graft floor — CubDB's append-only B-tree, on to Tigris object storage — at a reserved page range ordered by the branded EVT id, readable beside the live tail through a watermark merge-read. Deep history without resident memory. That floor is taught in full in Echo Persistence.

The rest of the system

The Bus is one reading of the shared substrate. The Queue distributes work over the same wire; the Cache serves reads in front of it; the Proof chapter shows the whole system holds. The Protocol below them all — the keyspace the stream keys are born to — is ready to read now.

The Queue and the Protocol are ready to read; the Bus modules, the Cache, and the Proof are on the build front, each added as its pages land.

References

Sources

Related in this course