WEBVTT 00:04.540 --> 00:11.590 OK, let's go on, let's put this property props dot put the name of the property is Bootstrap. 00:14.200 --> 00:15.240 Don't serros. 00:16.220 --> 00:19.220 And the VELIA will be localhost. 00:20.370 --> 00:27.270 1992, then at Commom and the type of localhost, the 1993. 00:28.440 --> 00:37.110 And one more localhost, 1994, and don't forget to add semicolon here, great Worster observers, the 00:37.110 --> 00:37.980 way I can figure out. 00:37.980 --> 00:43.560 And now let's add the key and value serializer in order to do it more quickly. 00:43.560 --> 00:48.210 Let me copy those two lines from here and paste the here and now. 00:48.210 --> 00:51.900 Let me explain you what actually those serializer rules mean. 00:52.350 --> 00:58.980 I have told you before that in Kafka, every message is actually a sequence of bytes and this sequence 00:58.980 --> 01:04.020 of bias is sent by producers and consumed by consumers. 01:04.530 --> 01:10.110 And as a result, every producer must know how to encode messages that it sends to Kafka. 01:10.110 --> 01:17.930 Gloster and each Kafka consumer must also know how to decode messages that are received from Kafka clasper. 01:18.240 --> 01:26.340 As you know, every message must contain value and optional key and keys and values and coded and decoded 01:26.340 --> 01:27.240 separately. 01:27.660 --> 01:34.650 And in this example, these encoder means that every key will be actually strewing. 01:34.980 --> 01:36.650 Same relates to value. 01:36.810 --> 01:39.780 Every well is expected to be a string. 01:40.260 --> 01:47.160 And if you try to supply to this producer, Anambra, instead of string, it will be able to apply this 01:47.160 --> 01:54.150 realisable because this serializer is used only for encoding into sequence of bytes, strings, not 01:54.150 --> 01:54.770 numbers. 01:55.380 --> 01:58.770 You are also able to use the or different serializer. 01:58.920 --> 02:03.870 And now let me actually quickly show you which serializer are available for that. 02:03.870 --> 02:06.840 Let's simply copied the serializer name. 02:07.080 --> 02:10.560 Go to Google Chrome, open up new type of base to this here. 02:10.560 --> 02:14.640 And let's also add Varosha number two DOT 4.0 in my case. 02:14.820 --> 02:16.800 And let's click on this first link. 02:17.870 --> 02:25.490 And here you may read the details about this glass doing realizing it is actually implemented in interface 02:25.490 --> 02:32.180 serializer, and by clicking on this interface name, you are able to get URLs or possible serialize 02:32.180 --> 02:40.100 URLs like Bitaraf, serializer by Bavaro, serializer along serializer, integer, serializer and so 02:40.100 --> 02:40.310 on. 02:40.820 --> 02:48.660 It means that you are able to use different serializer to encode keys and values that are sent by producer. 02:48.950 --> 02:55.590 But the most commonly used serializer is this one doing Serializer Borst for keys and values. 02:56.090 --> 03:01.790 OK, that's actually all mandatory parameters that we need to specify in order to be able to produce 03:01.790 --> 03:02.540 some messages. 03:02.810 --> 03:06.500 And next to let's create a new instance, our producer. 03:06.860 --> 03:09.760 Let's go to our example here, Whatley's. 03:09.770 --> 03:13.130 And we need to create a new instance of coproducer. 03:13.130 --> 03:17.480 And as an argument, we will supply here properties that we have set up. 03:17.780 --> 03:23.410 But please notice that here, instead of producer type, we need to use KAF coproducer type. 03:23.810 --> 03:26.410 Let's go to our project and create producer. 03:26.630 --> 03:28.930 Thus here will be Kafka producer. 03:29.120 --> 03:36.050 And if you'll press enter while typing, you'll see that coproducer will be automatically imported from 03:36.060 --> 03:43.760 Oracabessa Kafka, Glines Producer and Roquette that we have added this dependency to our Mavin project 03:43.760 --> 03:44.220 here. 03:44.750 --> 03:45.150 Great. 03:45.320 --> 03:49.540 Next, we need to specify types of parameters, string and string. 03:50.420 --> 03:52.220 Next will be the name of the variable. 03:52.220 --> 03:59.500 And let's name our producer or simply producer like this, and it will be a new instance of a Kafka 03:59.510 --> 04:00.350 producer. 04:00.590 --> 04:08.750 And he'll let supply props as argument work that we have configured props here about awesome producer 04:08.750 --> 04:15.980 was created and now lets, same as in this example, produce 100 messages simply as numbers like a zero, 04:15.980 --> 04:17.090 one, two and so on. 04:17.210 --> 04:22.820 And we will send Borski and well and we will use the producer record for that. 04:23.150 --> 04:28.220 And instead of mitotic, let's produce messages to Dobek Gold numbers. 04:28.460 --> 04:32.720 Please note that we have not yet created the topic numbers and we will do that in the next laubscher. 04:32.870 --> 04:35.050 But now let's finalize our producer. 04:35.360 --> 04:40.330 Let's go back to the project and let's keep it simple for a loop in order to create that quick list. 04:40.340 --> 04:49.050 Type four and the select four I hear from dropdown for I like this and let's iterate from zero to let's 04:49.130 --> 04:56.060 actually, instead of hard coding number here, use a variable like number of records and let's define 04:56.060 --> 05:02.720 this variable here above and it will be in the number of records and let's assign value. 05:02.780 --> 05:04.310 One hundred to you like this. 05:04.670 --> 05:12.080 And here inside of this loop, let's produce method just using this producer producer and here we will 05:12.080 --> 05:14.330 use sound method like this. 05:14.750 --> 05:18.710 And here as argument for this method, we need to use produce set record. 05:18.710 --> 05:22.180 And if you'll add apprentice's, you'll see this information here. 05:22.550 --> 05:22.940 Great. 05:23.120 --> 05:25.940 Let's not create a new producer record. 05:27.310 --> 05:33.100 And produce a record is located in the same package as Gulf coproducer, and if you will select produce 05:33.100 --> 05:39.010 a record here from the dropdown, you'll see that it will be automatically imported from the same package 05:39.010 --> 05:39.510 as well. 05:39.970 --> 05:43.090 And the he'll specify name of the topic. 05:43.240 --> 05:49.330 It will be numbers in our case and the next we need to specify key and value. 05:49.330 --> 05:56.940 While it is optional, let's specify for now Borski and value and let's use simply eyeballs for key 05:56.950 --> 06:01.110 and value and vocab data we are using doing serializer. 06:01.300 --> 06:05.700 This way we need to supply strings balls for key and value. 06:06.100 --> 06:13.360 We could use I and the same as in this example converted to string like this use integer glass and it's 06:13.360 --> 06:16.270 method to string and here I as argument. 06:16.570 --> 06:18.070 Let's do it in Dajarra. 06:19.090 --> 06:20.350 Door to door in. 06:22.530 --> 06:31.350 And here will be I like this, it will be Kim and next will be Balya again integer dot to string and 06:31.350 --> 06:32.880 here will be the same as for. 06:33.240 --> 06:35.920 I like this and it's also produced. 06:35.920 --> 06:38.690 The record will close it by adding semicolon. 06:38.700 --> 06:45.270 And let's finally after this full loop at the end of this method, let's close our producer producer 06:46.140 --> 06:49.310 Dot Glos without any arguments like that. 06:49.680 --> 06:50.100 Great. 06:50.280 --> 06:54.180 Our main method for producer Glass is ready and we are able to use it. 06:54.360 --> 06:55.860 And let's do that actually next. 06:55.860 --> 06:58.070 And next, let's create a new topic. 06:58.200 --> 07:01.770 Now let's start building console consumer. 07:02.040 --> 07:04.830 And afterwards we will try to start this producer. 07:04.920 --> 07:05.840 I'll see you next. 07:05.850 --> 07:06.320 Bye bye.