Menu

1 / 5

mq: a small Kafka-style message queue in Go, built from scratch

DEV Community: go·Abdeldjalil Chougui·17 days ago
#tcLCe7ka
#devtogo#devto#dev#offset#broker
Long article (1387 words) — no AI summary yet.
Reading 0:00
15s threshold

Kafka has a reputation for being complicated, and its vocabulary does not help: topics, partitions, offsets, segments, consumer groups, rebalances, generations. I used these words for a long time before I could explain why each one has to exist.

The quickest way I know to understand a design is to rebuild a small version of it. mq is a small Kafka-style message queue in Go, using only the standard library. It has topics split into partitions, an append-only segmented log per partition, consumer groups with committed offsets, retention, and a TCP protocol with a Go client. It is a single broker and a learning project. What it gave me is a clear picture of why a log sits at the centre of a message queue.

What it does

The code is four packages:

wal : the storage engine.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.