WEBVTT 00:04.560 --> 00:11.050 We have just successfully created a producer and the consumer in Python, and we have received the basically 00:11.100 --> 00:17.850 message by consumer here is this consumer record and we have sent actually only a single message by 00:17.850 --> 00:18.470 a producer. 00:18.480 --> 00:24.360 And here the contents of the message here was it's Bellear key was set to. 00:24.840 --> 00:27.450 And that's why here you see this as well. 00:27.660 --> 00:29.460 You see also topic name. 00:29.700 --> 00:32.100 This message was read from partition. 00:32.100 --> 00:38.790 It is a partition with 80 zero of said of this message inside of this partition timestamp and other 00:38.850 --> 00:41.820 related information about this going through my record. 00:42.240 --> 00:44.550 Now, let's expand a bit to this example. 00:44.700 --> 00:52.380 And instead of just a single message, let's send the 100 random names and let's send them to a topic 00:52.380 --> 00:53.260 called names. 00:53.400 --> 00:55.020 Let's modify this producer. 00:55.020 --> 00:59.160 And here we will import to Fakher from Fakher package. 00:59.410 --> 01:01.590 But first of all, we need to install it. 01:01.770 --> 01:04.510 Let me show you what actually this package does. 01:04.770 --> 01:05.680 Let's enter. 01:05.700 --> 01:07.530 Facher Python. 01:08.490 --> 01:11.190 And CrossLink should lead us to this package. 01:11.360 --> 01:18.430 Yes, here it is, you could actually fake different addresses, names or texts using this package. 01:18.720 --> 01:20.220 Let me scroll down a bit. 01:20.220 --> 01:24.930 And here you see examples of how you are able to fake different names. 01:25.230 --> 01:32.700 Let's install a fake or using a good paper using a package manager for Python and let me do that in 01:32.700 --> 01:36.880 this embedded terminal and let me open up a new terminal here. 01:37.320 --> 01:39.750 Let me clear it and I'll install it. 01:39.870 --> 01:42.360 Used to be a three for Python three. 01:42.870 --> 01:45.030 So be a B three. 01:46.000 --> 01:50.680 Install Fraker, Antawn, let me enter my password. 01:52.190 --> 01:58.610 Notice that with such command and installation, quake are globally, same as we did with a Kafka client, 01:59.150 --> 02:02.440 it seems that the now Fakher was successfully installed here. 02:02.450 --> 02:08.500 I sent this message and now I'm able to close this terminal window and use failure here. 02:08.750 --> 02:14.150 Let's import from fake or import fake like this. 02:14.330 --> 02:21.050 And afterwards, let's create a new instance of fake like so fake equals sign fake. 02:21.500 --> 02:25.380 And now we're able to use the different methods of fake. 02:25.790 --> 02:34.370 Let me here create a loop that will actually produce 100 messages and we will send 100 messages with 02:34.370 --> 02:35.270 different names. 02:35.660 --> 02:42.440 Let me create a loop of four underscore in range, let's say, 100 messages. 02:42.440 --> 02:46.670 You could send more if you want and here will produce. 02:46.850 --> 02:57.830 Let me move it here and I'll send the two topic names, messages like let me remove this and here will 02:57.830 --> 03:01.890 be called the fake dot name and where or parentheses. 03:02.150 --> 03:06.290 Of course, we need to convert to this result to bite format. 03:06.380 --> 03:09.040 And for that you could use encode method. 03:09.050 --> 03:15.410 And here, because actually we can call the strings window, specify encoding and it is UTF eight for 03:15.410 --> 03:15.860 text. 03:16.280 --> 03:17.240 That's actually all. 03:17.240 --> 03:23.600 And let's basically create here variable and assign this result to this variable. 03:23.600 --> 03:28.370 And afterwards we will also bring to the console this variable in order to ensure that the producer 03:28.370 --> 03:30.070 has actually sent messages. 03:30.440 --> 03:37.910 Let me do that like so name and here will be name and code to buy it. 03:38.510 --> 03:43.550 And also let's bring to the console print name. 03:44.580 --> 03:51.420 Like, so this should work now, let's save the gold to open up time terminal and let's produce those 03:51.420 --> 03:51.990 messages. 03:52.230 --> 03:57.800 Let me go to the tap where we have started produce our heroes staff and restarted once again. 03:58.410 --> 04:04.680 And yes, it seems that the messages were produced and we see here different names that were generated 04:04.680 --> 04:06.350 by Fakher package. 04:06.930 --> 04:08.590 Let's now go to consumer. 04:08.610 --> 04:15.720 It seems that it should still be running and we need to stop it because we have actually read messages 04:15.810 --> 04:21.150 from another topic, from our topic, and we need to read messages now from names. 04:21.150 --> 04:21.420 Stop. 04:21.580 --> 04:24.120 Let me replace a test with names. 04:24.120 --> 04:31.620 And here, let's say consumer group idea will be it now names like So let's save and let's roll around 04:31.620 --> 04:36.180 consumer buy them three consumer Dobi. 04:37.790 --> 04:44.360 And of course, we need to restart producer and generate 100 messages, because now we are reading from 04:44.360 --> 04:47.430 our current position in our politicians. 04:47.600 --> 04:53.810 Let me go to producer and run it clear terminal and start producer. 04:55.030 --> 04:57.230 Again, one hundred names were generated. 04:57.460 --> 05:02.410 Let's now go to consumer, and now I see how messages are received from two big names. 05:02.560 --> 05:08.770 And you see here that partition is the same here because in this case, two big names was again created 05:08.770 --> 05:11.110 automatically, same as the topic text. 05:11.320 --> 05:16.600 And when topic is created automatically by default, it gets just a single partition. 05:16.630 --> 05:20.470 That's why here we see everywhere partition with ID zero. 05:20.650 --> 05:26.260 But of says, of course, a different each message has unique offset inside of this partition. 05:26.620 --> 05:33.970 And as you see here, we successfully received different names and we are able to read them by a consumer 05:34.060 --> 05:37.120 like Emily Davidson, Jennifer Alem and so on. 05:37.690 --> 05:44.370 That's how we able pretty fast and easily great consumer and the producer in Python. 05:44.380 --> 05:50.890 And here I have demonstrated you just the simple example of how we are able to create different names, 05:50.890 --> 05:54.170 fake names and send them in separate messages. 05:54.490 --> 06:00.700 This all goes for this example and is usually project files will be available in GitHub repository by 06:00.700 --> 06:00.940 by.