Spring Boot + Apache Kafka Tutorial - #16 - Configure Wikimedia Producer and Create a Topic

Welcome to Spring Boot + Apache Kafka Tutorial series. In this lecture, we will configure Wikimedia Producer, and also we will create a Kafka topic in the Spring boot project.

Lecture - #16 - Configure Wikimedia Producer and Create a Topic


Hi. Welcome back. In press lecture, we have created a multimodal Marin project, so basically we have created a pattern project. Within that we have created a data project that is capture preserve Wikimedia. So this is a Wikimedia project. It acts as a capture producer. Now, in this lecture, let's go ahead and let's configure Wikimedia producer and also we'll create a topic within our Springwood project. So let's go into the idea and let's go to this module that is Capture, Preserve Wikimedia and just explain this AC and then go to Resources Border. So within Resources border, we are able to create application properties file. So choose file here and just view file name as application dot properties hit enter. So within this application properties when we're going to configure a producer, so just type the property spring dot com dot producer dot boost dev hyper servers. Well here we are going to configure this property because we are going to tell Springwood that this is the capture broker which is running on Port 9092. All right. So whenever we create a capture producer, it will, you know, read the real time stream data from the Wikimedia and then it will connect to the capture broker and then it will write that data to the capture. All right. Next, let's configure key serialize the value serialize for producer. Well, let's type the property spring dot copco dot producer dot key Sierra later and then colon or g dot apache. But you don't copco .1. civilization dot strings related. So similarly, let's configure values here laser class. So let me simply copy this property and paste into a year and let me change from key to value. All right. Now we have configured keys. You realize that only values and asset classes. Okay, so whenever we develop a producer lookup computer will internally use these, you know, serialized classes to serialize the input data. Okay, great. Next, we need to create the copycat topic. We'll go to the main package of this module and I click on the main package new and then Jorge, our class. Let's go class name and Kafka topic config. All right and hit Delta and let's annotate this class with add configuration annotation so that spring will make this class as a general configuration class. Let's create a bin spring bin within this class. So we're going to basically use Jarvis configuration to create a spring bin. So public and then return type is new copy class from Apache, Kafka, Plains Element Package and then you need method name here as a topic and let's return object up new topic class. So in order to build this object, we're going to use topic builder from spring package. Okay, Spring framework lookup product package and then it has an API. So let's use a name API and let's you the big name as Riki Wikimedia underscore recent change something like this and then call building method to build object. Okay, so you can also create the partition by using partitions here. What I want to keep, you know, default partitions that is created by Kafka broker. So let's see how this works. And it's after this method which I had been annotation perfect. Now we have created a copycat topic. Okay, great. Well, let me recap what we are done in this lecture. We have created application or properties file. Within this file we are configured guys utilize our own developer, utilize our classes for the Kafka producer and we have also mentioned the Kafka broker you will hear next. We have created a Kafka topic named Wikimedia and is what is change? All right, great. In next lecture, we'll start implementing Wikimedia producer. All right, great. I was here in the next lecture.