23. Properties config = new Properties();
config.put(StreamsConfig.APPLICATION_ID_CONFIG, "streams-starter-app");
config.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "server-lb:9092");
config.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG,
Serdes.String().getClass());
config.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG,
Serdes.String().getClass());
KStreamBuilder builder = new KStreamBuilder();
KStream<String, String> kStream = builder.stream("input-topic-name");
// do stuff
kStream.to("word-count-output");
KafkaStreams streams = new KafkaStreams(builder, config);
streams.start();
// Do aggregation making the word as the key and count as the value
// shutdown hook to correctly close the streams application
Runtime.getRuntime().addShutdownHook(new Thread(streams::close));
36. Name Account Balance
Alice $100
Bob $200
Domain Event
Alice gives Bob $50
Bob give Alice $100
Name Account Balance
Alice $150
Bob $150
Change Log Event Stream
Alice’s Acct. Balance is $50
Bob’s Acct. Balance is $250
Alice’s Acct. Balance is $150
Bob’s Acct Balance is $150
Current State