WEBVTT 00:04.530 --> 00:10.830 So far, we have agreed that the new Mabern project intelligence and also we have started the new coffeecake 00:10.830 --> 00:15.060 last hour here, Resor doorkeeper and here are three different brokers in the class. 00:15.720 --> 00:20.760 Now, it's a good time to create producer and consumer in our project. 00:20.760 --> 00:23.240 And we will start with creation of producer. 00:23.490 --> 00:29.070 And without a doubt now it's a really good time to show you how to use Aperture Kafka documentation. 00:29.370 --> 00:35.030 So please navigate to Kafka dot aperture dot org and the here select documentation. 00:35.640 --> 00:41.130 And on this page you'll find documentation of four different KAF commercials at the moment of recording 00:41.130 --> 00:41.760 of the scrolls. 00:41.790 --> 00:46.080 The last version is 2.0 and the version I am using in this scrolls. 00:46.260 --> 00:49.060 And that's why I'll use this documentation version. 00:49.410 --> 00:54.990 If you use another version, please the choose your version for your setup here. 00:54.990 --> 01:01.860 Below, you may find different sections how to get started, the different APIs, different configuration 01:01.860 --> 01:05.670 settings, design, implementation operations and so on. 01:05.940 --> 01:09.470 Really, really much information related to our project outcome. 01:09.810 --> 01:16.500 But what we are going to use here in order to build our sample producer and consumer. 01:17.010 --> 01:21.780 First of all, we will use producer API and Consumer API. 01:22.200 --> 01:26.400 Also, we will use producer confidence and consumer confidence. 01:26.850 --> 01:31.950 Let me throw open producer API in a separate step like this. 01:32.980 --> 01:39.730 And then this step in producer ABI section, you may find another link to examples that show how to 01:39.730 --> 01:41.200 use producer in Java. 01:41.590 --> 01:44.190 Let's open up this link in a new tab as well. 01:44.440 --> 01:50.710 And also here on this page, you'll see that in order to use producer in Java, you need to install 01:50.740 --> 01:52.710 following Maimon dependency. 01:52.960 --> 01:55.690 And that's what we are about to do right now. 01:56.080 --> 02:00.610 Let's go to our project and go to Bombed-out example file. 02:00.910 --> 02:07.270 And here in the project section, along with version of properties, the group idea and so on, you 02:07.270 --> 02:08.470 should add dependencies. 02:08.710 --> 02:13.980 And in order to quickly add the new dependency, you can Prosky combination of government control and 02:14.020 --> 02:16.910 like this and select dependency. 02:17.620 --> 02:21.980 And here in the search bar, you are able to search for specific dependency. 02:22.300 --> 02:29.110 Let's go to Google Chrome and the name of our dependency is Coffeecake Lions, and it is located in 02:29.110 --> 02:30.930 Oregon up Jadot Kafka. 02:31.330 --> 02:34.210 Let's search here simply for Kafka like this. 02:34.480 --> 02:39.480 And here in the search results, you'll basically find coffeecake lines as a froster result. 02:39.790 --> 02:45.490 Let's expand it and you should select the version that is compatible with your installation. 02:45.670 --> 02:50.590 And I'll select this one version 2.0 and click at. 02:51.990 --> 02:58.000 And you'll see that intelligence will automatically add new dependancy to our project. 02:58.620 --> 03:01.260 Also, you have seen that for a short period of time. 03:01.260 --> 03:02.860 Those things were in red. 03:02.970 --> 03:08.050 And that's because someone was actually downloading this dependency. 03:08.340 --> 03:13.420 And again, we will use the Kafka Lines API, both for producer and consumer. 03:13.960 --> 03:14.300 Great. 03:14.520 --> 03:16.500 Let's go back to documentation. 03:16.500 --> 03:23.760 And here, let's open up this example that will show how to create a new producer here. 03:23.760 --> 03:32.340 You're able to scroll down and find the actually basic example on how do Loung basic producer and obviously 03:32.340 --> 03:38.280 we need to have a Kafka Gloster up and running before starting a new producer and same as we did in 03:38.280 --> 03:39.610 Kafka console producer. 03:39.780 --> 03:45.840 We need to specify bootstrap Sarovar at least one, for example, in this case that there is default 03:45.840 --> 03:47.340 Sarah with default settings. 03:47.580 --> 03:51.720 And also we need to specify a topic we want to produce messages to. 03:51.930 --> 03:54.830 And in this example, topic name is my topic. 03:55.200 --> 04:02.070 This are actually two mandatory settings and also we need to specify key and value serializer. 04:02.460 --> 04:04.850 I'll explain to you what is that just in a minute. 04:05.310 --> 04:09.420 Also, accept those properties that you are able to set for producer. 04:09.540 --> 04:13.140 You could set to many, many hours or different properties. 04:13.440 --> 04:21.120 And before starting with our own producer Glass, let me show you how to find out where properties allocate. 04:21.480 --> 04:27.050 Please go to documentation tab and the here scroll down to producer conflicts. 04:27.480 --> 04:29.400 Let me open it up in a new tab. 04:29.640 --> 04:30.480 Go down. 04:30.690 --> 04:37.530 And on this page you may find all settings you are able to use along with your producer. 04:37.740 --> 04:43.140 And this page is useful because you are able to find out how properties are called. 04:43.440 --> 04:51.000 For example, here is a proper deal was named Guidotti, Serializer and Özal property name is Hox and 04:51.000 --> 04:54.030 if you scroll down you'll find the Bootstrap Ozawa's. 04:54.180 --> 05:01.350 It is actually mandatory property and accept that there are many, many different properties like compressional, 05:01.350 --> 05:06.270 the type or Dryas SSL dot keystroke, that password and so on. 05:06.360 --> 05:07.770 Many, many different properties. 05:07.770 --> 05:14.780 And I will not explain every property in the Dales, but I'll try to focus on mostly used of them. 05:15.210 --> 05:15.590 Great. 05:15.870 --> 05:23.490 Let's now go to our project and let's create the very first example of our producer based on this example. 05:23.790 --> 05:31.050 OK, so let's go here and in Java folder, let's create a new class and name of the class will be a 05:31.050 --> 05:31.770 producer. 05:32.070 --> 05:40.440 Right mouse click select Java class and type name producer like this press enter and new class will 05:40.440 --> 05:41.780 be created here. 05:41.850 --> 05:46.050 Lets is usually create main method they main and press enter. 05:46.260 --> 05:49.470 And first we need to initialize new instance of properties. 05:49.650 --> 05:56.080 Let's use properties class and if your type properties and afterwards press enter, you'll see that 05:56.080 --> 06:03.240 the intelligence will automatically import properties from Java DOT ordeal and let's name properties 06:03.240 --> 06:10.710 like probes and we will initialize this variable simply like these new properties and no arguments at 06:10.710 --> 06:13.680 SEMICON and no probs variable is available for use. 06:14.160 --> 06:20.910 Let's now put some properties and mandatory properties are bootstrap sevres key serializer and values 06:20.910 --> 06:21.750 serializer. 06:21.930 --> 06:23.790 Our property is optional. 06:24.060 --> 06:29.760 Hence let's specify these properties, bootstrap those Sarahs and notice that in this example there 06:29.760 --> 06:31.080 was just a single Sarah. 06:31.110 --> 06:37.080 But we have three Saras in the Glouster and I recommend you to specify all of them in this property 06:37.290 --> 06:43.250 because in case you specify only single server, you will be still able to connect to entire Glouster 06:43.260 --> 06:45.600 and produce messages to all serros. 06:45.930 --> 06:52.560 But in case this single fails, you will not be able any more connect the entire cluster and you will 06:52.560 --> 06:54.270 not be able to produce any messages. 06:54.720 --> 07:00.510 That's why for redundancy, I highly recommend you to specify at least a two or three serros from your 07:00.510 --> 07:01.230 colostrum. 07:01.620 --> 07:03.600 Let's not make a short break and proceed next.