Level Up Your Kafka Skills in Just 5 Days | Join Season of Streaming On-Demand

Presentation

Better CQRS with ksqlDB

« Kafka Summit APAC 2021

A deep dive into achieving excellent command query segregation with ksqlDB and the lessons learnt!

CQRS is a design pattern where the command and query execution could use different data models and databases. Typically any changes from command execution get published to Kafka and updates the query database.

However there are many use cases where command execution needs some of the query execution data. We initially solved this problem by calling the query APIs from the command execution side. However this caused strong dependency between systems that were supposed to work independently.

We solved this problem by publishing the query model changes to Kafka and using ksqlDB to create state stores to store this data locally in command services. Although the data is distributed between instances of ksqlDB, a command service instance can fetch any data from its local instance. We have even created new aggregations from query models that are better suited for command flow.

Chinese Japanese Korean

Related Links

How Confluent Completes Apache Kafka eBook

Leverage a cloud-native service 10x better than Apache Kafka

Confluent Developer Center

Spend less on Kafka with Confluent, come see how