Chapter 4. Streams and state

 

This chapter covers

  • Applying stateful operations to Kafka Streams
  • Using state stores for lookups and remembering previously seen data
  • Joining streams for added insight
  • How time and timestamps drive Kafka Streams

In the last chapter, we dove headfirst into the Kafka Streams DSL and built a processing topology to handle streaming requirements from purchases at ZMart locations. Although you built a nontrivial processing topology, it was one dimensional in that all transformations and operations were stateless. You considered each transaction in isolation, without any regard to other events occurring at the same time or within certain time boundaries, either before or after the transaction. Also, you only dealt with individual streams, ignoring any possibility of gaining additional insight by joining streams together.

In this chapter, you’ll extract the maximum amount of information from the Kafka Streams application. To get this level of information, you’ll need to use state. State is nothing more than the ability to recall information you’ve seen before and connect it to current information. You can utilize state in different ways. We’ll look at one example when we explore the stateful operations, such as the accumulation of values, provided by the Kafka Streams DSL.

4.1. Thinking of events

4.2. Applying stateful operations to Kafka Streams

4.3. Using state stores for lookups and previously seen data

4.4. Joining streams for added insight

4.5. Timestamps in Kafka Streams

Summary

sitemap