Skip to content
Kafka Is FunProgress

AdvancedArchitecture

Explain event sourcing with Kafka. What are the trade-offs?

Reference answer

Event sourcing stores the state of an entity as a sequence of events in Kafka (one partition per entity, or key-partitioned topic). The current state is derived by replaying events. Advantages: full audit history, temporal queries, replay to fix bugs, natural event-driven integration. Challenges: long-running aggregate histories require snapshots (Kafka Streams KTable handles this); event schema evolution is complex; CQRS is required for efficient reads (separate read model from event store); eventual consistency is the norm. Kafka's durable log + log compaction makes it a natural event store.

Expected key concepts: event sourcing, events, replay, audit history, temporal queries, snapshots, CQRS, eventual consistency, log compaction, read model, schema evolution