Apache Kafka provides distributed event streaming for high-throughput applications. Topics partition data for parallelism. Consumer groups enable scalable processing. Retention preserves events for replay.
Core Concepts
Producers publish to topics. Topics partition across brokers. Consumers read from partitions. Consumer groups distribute partition processing. Offset tracking enables exactly-once semantics.
- Design topics around event types or domains
- Partition by key for ordered processing
- Configure replication for durability
- Set retention based on replay requirements
- Monitor consumer lag for processing health
Architecture Patterns
Event sourcing stores all state changes. CQRS separates read and write models. Saga pattern coordinates distributed transactions. Stream processing transforms events in flight.