Kafka
A distributed append-only log used as a message broker: messages survive being read, and many consumers process them independently.
Kafka is a Message Broker built around one idea: a distributed append-only log. Publishers write messages to the end of the log. Consumers read from any position they choose, and reading a message doesn't delete it.
This is what sets Kafka apart from most brokers. A typical queue treats a message as something to deliver and forget. Kafka keeps messages on disk, in order, for as long as you configure: days, months, or forever. A new service can start today and process events published last year. After fixing a bug, you can rewind a consumer and reprocess everything it got wrong.
Each Topic is split into partitions, and the partition is the unit of both ordering and parallelism. Kafka guarantees order within one partition, not across the topic. Messages published with the same partition key (an order ID, a user ID) always land in the same partition, so events about one entity arrive in the order they happened.
Consumers track their progress with offsets: each consumer remembers how far into each partition it has read. Offsets belong to the consumer, not the broker, so any number of consumers can read the same topic without affecting each other. A Consumer Group spreads a topic's partitions across instances of one service, which means scaling out is adding members to the group.
References
- Using MySQL as a Pub/Sub: Compares SQL databases with Kafka and RabbitMQ as Pub/Subs, covering Kafka's persistent topic storage and an example of forwarding messages from MySQL to Kafka.
- Introducing Watermill - Go event-driven applications library: Introduces Kafka as one of Watermill's first supported Pub/Subs and explains why to avoid the raw Kafka driver: acknowledgments, error handling, and publishing are easier behind a universal abstraction.
- Watermill v0.2.0 released: Replaces Watermill's Kafka implementation with Sarama, removing the cgo dependency and improving publishing throughput from 10k to 75k messages per second. Lists the Kafka API breaking changes.
- Synchronous vs Asynchronous Architecture: Discusses Kafka among broker choices for asynchronous communication, including partitioning as the built-in answer to message ordering and schema registry support for validating message schemas.
- Watermill: from a hobby project to 8k stars on GitHub: Shares how 'Kafka is scary' fears shaped Watermill's high-level API, and why the Kafka Pub/Sub implementation had to be bumped to v2 early because of breaking changes.
- Event-Driven Architecture: The Hard Parts: Covers message broker reliability and delivery guarantees, and notes Kafka's operational weight: it's the heavyweight exception when running brokers in local and CI environments.
- Go Event-Driven Training: The training covers Kafka and other message brokers hands-on, from choosing a broker to consumer groups, ordering, and fault tolerance.
- Apache Kafka