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.

Leaderboards: Pipeline implementation

Leaderboards: Pipeline implementation

- [Instructor] Let us now review the pipeline code for managing leaderboards for player scores. We first set up an instance of the RedisManager as redisTracker, this is run in a separate thread, this tracker will print the current leaderboard snapshot, every five seconds from Redis. Next, we set up another instance of the RedisManager as redisUpdater. This instance is used to update Redis with the scored increments for players, note that the entire pipeline would run as a single thread, and hence, we would use this one connection to update scores. Managing scores in an external database means it can be consolidated across all consumers. Then we will also start the KafkaGamingDataGenerator in a separate thread. This will produce code increments for players at random intervals. We then set up the serdes for keys and values and also the properties for the Kafka broker to use. We then start a stream to consume the…

Contents