From the course: Stream Processing Design Patterns with Kafka Streams

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Alerts and thresholds: Helper classes

Alerts and thresholds: Helper classes

- In this video, I will discuss the helper classes needed for the alerts and thresholds use case. The code for this chapter is available in the package, com.learning.Kafkastreaming.chapter3. Let's review the Kafka alerts data generator class. This class generates random exception records into the streaming.alerts.inputtopic. We start off by setting up a connection to the Kafka broker running on local host. We define a list of exception levels from which we can randomly choose to form a dummy record. We also define a list of exception codes. The record key is created based on the current timestamp. We then proceed to generate hundreds sample exception messages. We create the timestamp for the message, using the current timestamp. Then we pick one of the random levels from the list of levels. Similarly, we pick a random exception code from the list of codes. Using the data generated, we form a CSV string with all…

Contents