Integration / Apache Kafka Interview questions
What are Kafka Streams used for?
Kafka Streams is a client library for building applications that read from one or more Kafka topics, transform or aggregate that data in-flight, and typically write results back to another Kafka topic — all as a normal JVM application, with no separate stream-processing cluster (like Spark or Flink) to deploy and operate.
StreamsBuilder builder = new StreamsBuilder(); builder.stream("orders") .filter((key, value) -> value.contains("high-value")) .to("high-value-orders"); KafkaStreams streams = new KafkaStreams(builder.build(), props); streams.start();
Common use cases include filtering and enriching event streams, joining two topics together (e.g. orders joined with customer data), and stateful aggregations (running counts, windowed averages) using local state stores backed by an internal changelog topic for fault tolerance. Because it's just a library rather than a separate processing framework, scaling a Kafka Streams application is as simple as running more instances of the same JVM application, which automatically divide up the input topic's partitions among themselves the same way a Kafka consumer group does.
More Related questions...