From the course: Apache Kafka Essential Training: Getting Started (2021)
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Producing and consuming data with Java
From the course: Apache Kafka Essential Training: Getting Started (2021)
Producing and consuming data with Java
- [Instructor] In this video, let's look at the final exercise for the course. Producing and consuming messages in kafka. The code for this exercise is available in the package com.learning.kafkagettingstarted.chapter6. It has two files. Kafka use case producer and kafka use case consumer. The code is simple and resembles the producer and consumer we built earlier in the course. Let's run the producer and consumer now. We see the results as expected. The base template for producers and consumers are the same. When you build production grade code though, you will need to change your implementation based on few things. On the producer side, this code currently blocks until the producer actually publishes to kafka. So this may not scale well. You may want to explore a synchronize publishing capabilities. On the consumer side, you may want to launch processing on a separate thread so the consumer is not blocked.…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.