ksqlDB tutorials and examples

Confluent provides many resources for learning how to create ksqlDB applications.

ksqlDB quick starts

Confluent developer courses

  • ksqlDB 101: This course covers ksqlDB architecture, how ksqlDB works, and typical use cases, with examples.
  • Inside ksqlDB: This advanced ksqlDB course shows you how to read, write, process, and transform data using common queries and functions in SQL.

Confluent demos on Gitpod

Common use cases

Use ksqlDB to implement solutions for these common use cases.

Materialized view/cache

  • Materialized view/cache: Create and query a set of materialized views about phone calls made to a call center. This tutorial demonstrates capturing changes from a MySQL database, forwarding them into Kafka, creating materialized views with ksqlDB, and querying them from your applications.

Streaming ETL pipeline

  • Streaming ETL pipeline: Create a streaming ETL pipeline that ingests and joins events together to create a cohesive view of orders that have shipped. This tutorial demonstrates capturing changes from Postgres and MongoDB databases, forwarding them into Kafka, joining them together with ksqlDB, and sinking them out to ElasticSearch for analytics.
  • Confluent Platform demo: Deploy a Kafka streaming ETL that uses ksqlDB for stream processing. All components in the Confluent Platform demo have encryption, authentication, and authorization configured end-to-end.
  • Use Case: Streaming ETL: Confluent makes it easy to gain real-time insights by moving from batch to streaming ETL through scalable, performant, and cloud-native data pipelines. Ingest, aggregate, and transform data streams in-flight from any system, application, or device at any scale and across any environment, to power real-time analytics use cases.

Event-driven microservice

  • Event-driven microservice: Create an event-driven microservice that identifies suspicious activity and notifies customers. This tutorial demonstrates finding anomalies with ksqlDB and sending alert emails using a simple Kafka consumer with SendGrid.
  • Use Case: Event Driven Microservices: Completely decouple your architecture and eliminate interservice dependencies so developers can build business logic faster. Build a new class of highly scalable event-driven microservices that are resilient in design and contextually aware.

Clickstream data analysis pipeline

Clickstream analysis is the process of collecting, analyzing, and reporting aggregate data about which pages a website visitor visits and in what order. The path the visitor takes though a website is called the clickstream.

This tutorial focuses on building real-time analytics of users to determine:

  • General website analytics, such as hit count and visitors
  • Bandwidth use
  • Mapping user-IP addresses to actual users and their location
  • Detection of high-bandwidth user sessions
  • Error-code occurrence and enrichment
  • Sessionization to track user-sessions and understand behavior, like per-user-session-bandwidth and per-user-session-hits

If you don’t have Docker, you can run an automated version of the Clickstream tutorial designed for local Confluent Platform installs. Running the Clickstream demo locally without Docker requires that you have Confluent Platform installed locally, along with Elasticsearch and Grafana.

ksqlDB examples

Confluent provides many examples and how-to guides to help you develop your ksqlDB applications.

Examples are short code snippets that show frequently-used ksqlDB operations, for example:


How-to Guides provide compact lessons that help you work with common ksqlDB functionality, for example:

Kafka tutorials

  • Kafka Tutorials include step-by-step instructions for building ksqlDB and Kafka applications.

Free Ebook: Mastering Kafka Streams and ksqlDB

  • Mastering Kafka Streams and ksqlDB: Learn important stream processing concepts, use cases, and several interesting business problems. Learn the strengths of both Kafka Streams and ksqlDB to help you choose the best tool for each unique stream processing project. Non-Java developers will find the ksqlDB path to be an especially gentle introduction to stream processing.

ksqlDB videos

See the latest videos on Confluent Platform ksqlDB and Confluent Cloud ksqlDB at the Confluent YouTube channel.

Video Description
ksqlDB HowTo: A mini video series Robin Moffatt’s quick videos about ksqlDB, based on demo scripts that you can run for yourself.
Apache Kafka 101: ksqlDB Tim Berglund provides a gentle introduction to ksqlDB concepts and queries.
Confluent Cloud Quick Start, ksqlDB, and Project Reactor (Redux) Viktor Gamov provisions Kafka, Connect, and ksqlDB clusters in Confluent Cloud and accesses with the ksqlDB Reactor client.
Demo: The Event Streaming Database in Action Tim Berglund builds a movie rating system with ksqlDB to write movie records into a Kafka topic.
Demo: Seamless Stream Processing with Kafka Connect & ksqlDB Set up and build ksqlDB applications using the AWS source, Azure sink, and MongoDB source connectors in Confluent Cloud.
Introduction to ksqlDB and stream processing Vish Srinivasan talks Kafka stream processing fundamentals and discusses ksqlDB.
Ask Confluent #16: ksqlDB edition Gwen Shapira hosts Vinoth Chandar in a wide-ranging talk on ksqlDB.
An introduction to ksqlDB Robin Moffatt describes how ksqlDB helps you build scalable and fault-tolerant stream processing systems.
ksqlDB and the Kafka Connect JDBC Sink Robin Moffatt demonstrates how to use ksqlDB with the Connect JDBC sink.
How to Transform a Stream of Events Using ksqlDB Viktor Gamov demonstrates how to transform a stream of movie data.
ksqlDB Java Client and Confluent Cloud Viktor Gamov takes the ksqlDB Java client for a spin and tests it against Confluent Cloud.