Kafka Summit Logo
Organized by

Kafka Summit London 2019

Streaming platforms at massive scale.

May 13-14, 2019 | London

The Source of Truth… Twice

Session Level: Intermediate

In this talk we’ll see how to leverage Apache Kafka not only as an event log, a role for which Kafka is well known (our beloved ‘source of truth’), but also as a persistence engine to implement the CQRS and Event Sourcing pattern. We’ll see how it is possible to use Kafka Streams API to allow a fast access to the current state of a DDD aggregate object and how make it queryable (by the service itself and by other external actors) in order to check if a command can be applied and produce one or more events. We’ll see then how to create a Kafka Stream Topology that uses the produced events to update the state of the aggregate itself, to let the cycle begin again. The goal of this talk is to show that Kafka can be the unique source of truth, not only for what happened (the events) but also for what it is now (the current state of an aggregate). The solution shown is completely Kafka-based, and this allows us to be consistent and avoid the well known problem we face when we have to update a repository and publish an event on the bus, two operations that, in most of the cases, cannot be considered as atomic.


We use cookies to understand how you use our site and to improve your experience. Click here to learn more or change your cookie settings. By continuing to browse, you agree to our use of cookies.