Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

KAFKA STREAMS

11/7/24, 21:24 Apache Kafka

The easiest way to write mission-critical real-time applications and


microservices

Kafka Streams is a client library for building applications and microservices, where the input and output
data are stored in Kafka clusters. It combines the simplicity of writing and deploying standard Java and
Scala applications on the client side with the benefits of Kafka's server-side cluster technology.

TOUR OF THE STREAMS API

1 Intro To Streams

2 Creating A Streams Application

3 Transforming Data Pt. 1

4 Transforming Data Pt. 2

Why you'll love using Kafka Streams!

Elastic, highly scalable, fault-tolerant

Deploy to containers, VMs, bare metal, cloud

Equally viable for small, medium, & large use cases


Write Your First App
Fully integrated with Kafka security

Write standard Java and Scala applications

https://kafka.apache.org/documentation/streams/ 1/5
11/7/24, 21:24 Apache Kafka

Kafka Streams use cases

The New York Times uses Apache Kafka and the Kafka Streams to store and distribute, in real-time,
published content to the various applications and systems that make it available to the readers.

As the leading online fashion retailer in Europe, Zalando uses Kafka as an ESB (Enterprise Service
Bus), which helps us in transitioning from a monolithic to a micro services architecture. Using Kafka
for processing event streams enables our technical team to do near-real time business intelligence.

LINE uses Apache Kafka as a central datahub for our services to communicate to one another.
Hundreds of billions of messages are produced daily and are used to execute various business
logic, threat detection, search indexing and data analysis. LINE leverages Kafka Streams to reliably

https://kafka.apache.org/documentation/streams/ 2/5
11/7/24, 21:24 Apache Kafka

Pinterest uses Apache Kafka and the Kafka Streams at large scale to power the real-time, predictive
budgeting system of their advertising infrastructure. With Kafka Streams, spend predictions are
more accurate than ever.

Rabobank is one of the 3 largest banks in the Netherlands. Its digital nervous system, the Business
Event Bus, is powered by Apache Kafka. It is used by an increasing amount of financial processes
and services, one of which is Rabo Alerts. This service alerts customers in real-time upon financial
events and is built using Kafka Streams.

Trivago is a global hotel search platform. We are focused on reshaping the way travelers search for
and compare hotels, while enabling hotel advertisers to grow their businesses by providing access
to a broad audience of travelers via our websites and apps. As of 2017, we offer access to
approximately 1.8 million hotels and other accommodations in over 190 countries. We use Kafka,
Kafka Connect, and Kafka Streams to enable our developers to access data freely in the company.
Kafka Streams powers parts of our analytics pipeline and delivers endless options to explore and
operate on the data sources we have at hand.

Hello Kafka Streams

https://kafka.apache.org/documentation/streams/ 3/5
2 import org.apache.kafka.common.utils.Bytes;
11/7/24, 21:24
3 import org.apache.kafka.streams.KafkaStreams;
Apache Kafka

4 import org.apache.kafka.streams.StreamsBuilder;
5 import org.apache.kafka.streams.StreamsConfig;
6 import org.apache.kafka.streams.kstream.KStream;
7 import org.apache.kafka.streams.kstream.KTable;
8 import org.apache.kafka.streams.kstream.Materialized;
9 import org.apache.kafka.streams.kstream.Produced;
10 import org.apache.kafka.streams.state.KeyValueStore;
11
12 import java.util.Arrays;
13 import java.util.Properties;
14
15 public class WordCountApplication {
16
17 public static void main(final String[] args) throws Exception {
18 Properties props = new Properties();
19 props.put(StreamsConfig.APPLICATION_ID_CONFIG, "wordcount-application"
20 props.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "kafka-broker1:9092"
21 props.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.String(
22 props.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.String
23
24 StreamsBuilder builder = new StreamsBuilder();
25 KStream<String, String> textLines = builder.stream("TextLinesTopic");
26 KTable<String, Long> wordCounts = textLines
27 .flatMapValues(textLine -> Arrays.asList(textLine.toLowerCase().sp
28 .groupBy((key, word) -> word)
29 .count(Materialized.<String, Long, KeyValueStore<Bytes, byte[]>>as
30 wordCounts.toStream().to("WordsWithCountsTopic", Produced.with(Serdes.S
31
32 KafkaStreams streams = new KafkaStreams(builder.build(), props);
33 streams.start();
34 }
35
36 }

https://kafka.apache.org/documentation/streams/ 4/5
registered trademarks or trademarks of The Apache Software Foundation in the United States and other countries.
Security | Donate | Thanks | Events | License | Privacy
11/7/24, 21:24 Apache Kafka

https://kafka.apache.org/documentation/streams/ 5/5

You might also like