WEBVTT 00:04.540 --> 00:08.300 Now, you should have a python installed on your computer and we are able to proceed. 00:08.560 --> 00:14.770 Let's open up a list of commands and quickly start the zookeeper and the calf Cabral girls, if you 00:14.770 --> 00:17.060 don't have them up and running already. 00:17.320 --> 00:20.320 Let me select this command, go to terminal. 00:20.440 --> 00:26.890 And here I have actually prepared several steps in order to start the zookeeper and I'll broadcast more 00:26.890 --> 00:27.380 quicker. 00:27.700 --> 00:29.320 So here is the zookeeper. 00:29.500 --> 00:33.670 Next comes throws the breuker with a desirable. 00:34.580 --> 00:41.210 Also, please make sure that you have copied Sarah configuration files from this example to config folder 00:41.210 --> 00:42.020 in Kafka. 00:42.350 --> 00:48.020 OK, let's go to the next step, Bastante, and that is to broker a procedure is the same as in previous 00:48.020 --> 00:54.500 sections and you could safely skip it and move the next lesson if you have already all broken up and 00:54.500 --> 01:00.020 running and the last broker with 82 will be started in this last step. 01:00.510 --> 01:05.900 OK, now we are ready to proceed and let's create the new project for Python files. 01:06.170 --> 01:08.050 I'll create that on the desktop. 01:08.060 --> 01:11.570 Let me go there and here on the desktop. 01:11.570 --> 01:15.120 I'll read your folder with name Sublett Kafka. 01:15.170 --> 01:22.550 Like this and the here inside I'll create the two new files producer Tobii and the Consumer API. 01:22.760 --> 01:23.720 But let's do that. 01:23.870 --> 01:25.150 Individuals to the code. 01:25.170 --> 01:31.580 Go down, open our project from here, go to desktop or select Kafka. 01:31.580 --> 01:32.540 Click open. 01:33.660 --> 01:42.320 And here, let's create two files, producer Dobi and the Let's Create the Consumer don't buy as well. 01:42.660 --> 01:45.630 Let's also install recommended extensions here. 01:45.810 --> 01:48.540 Let's click on this button installing. 01:50.420 --> 01:57.230 Extensions were installed and let me close those two pop ups and now let's start by creating a producer 01:57.530 --> 02:01.400 and we will use a library called the Kafka Python. 02:01.580 --> 02:03.670 Let me show you quickly. 02:03.860 --> 02:07.790 Let's open up new tab here and type Kafka. 02:08.210 --> 02:14.690 Python and FirstLine will lead you actually to the page where you are able to read about this Python 02:14.690 --> 02:16.520 client for Obayashi Kafka. 02:16.670 --> 02:23.000 And of course, here are several examples below and deferrals to what we need to do is to install a 02:23.000 --> 02:26.320 Kafka Python and let's install the globally on a computer. 02:26.360 --> 02:28.100 I will not use those environments. 02:28.100 --> 02:30.560 I don't want to overcomplicate this example. 02:30.590 --> 02:34.850 I launch a consumer and producer using Python three this way. 02:35.000 --> 02:38.120 Instead of this comment, I'll use the IP three. 02:38.210 --> 02:41.410 It is a package manager, a third version of Python. 02:41.690 --> 02:51.080 Let me go to a terminal and here in this step and pipe three install Kafka Python like soul. 02:53.250 --> 02:57.490 And we got an error, couldn't install the packages due to environment error. 02:57.630 --> 02:58.650 Permission denied. 02:58.860 --> 03:01.830 Let me try to do the same using Sudam. 03:02.040 --> 03:04.290 Let me spend it with pseudo. 03:05.360 --> 03:06.560 Enter my password. 03:08.940 --> 03:13.260 And no, Kafka was installed successfully and now we are ready to use it. 03:13.560 --> 03:18.000 Let's go to our project, Individual Studio Gold, and let's first grade producer. 03:18.240 --> 03:19.790 And it is pretty simple. 03:19.800 --> 03:28.550 We should throw the import Kafka coproducer from Kafka package like Saul from Kafka Import Kafka producer. 03:28.740 --> 03:34.410 You could use autocomplete here step and the next let's create new producer. 03:34.590 --> 03:37.760 Producer equals sign Kafka producer. 03:38.010 --> 03:43.290 And here you need to specify mandatory parameter, same as for other APIs. 03:43.290 --> 03:46.740 And you could guess that it is a list of bootstrap servers. 03:46.980 --> 03:54.420 So here type parameter name would strap underscore salaries and you could use either a single server 03:54.420 --> 04:01.650 and in such case you could simply type here localhost 1992 like Seoul, or we could use array of servers 04:01.650 --> 04:03.230 for greater redundancy. 04:03.480 --> 04:12.180 Let's use here array of centers like Seoul and let me copy this Celeron and the paste it here two times 04:12.360 --> 04:17.870 and the change boards here will be 1993 and the here will be 1994 like that. 04:18.450 --> 04:26.610 Next we are able basically to send messages using a coproducer send method producer the sent and here 04:27.150 --> 04:30.910 comes the topic name and let's send the message to test. 04:31.470 --> 04:35.420 It will be created automatically if we have not yet done that manually. 04:35.640 --> 04:41.920 And the next comes message and actually we are able to convert stream to buy it directly here using 04:41.920 --> 04:42.870 the following syntax. 04:43.080 --> 04:47.160 B and next comes a string and let's send a message. 04:47.340 --> 04:54.780 Hello from the Python producer like this, that's all what we need to do in order to create a basic 04:54.780 --> 04:55.920 producer in Python. 04:56.100 --> 04:58.170 Let's save this file, open up. 04:58.170 --> 05:04.290 And by the time and now control McTigue and let's finally start our producer using Python three for 05:04.290 --> 05:06.240 that type of Python three. 05:06.240 --> 05:10.560 And here, name of the file producer PUA Press enter. 05:11.610 --> 05:18.090 And it seems that the program was executed successfully and message was sent to test topic, but in 05:18.090 --> 05:24.050 order to verify that this message has actually arrived to the topic, we need to start consumer and 05:24.150 --> 05:25.980 start consumption of the messages. 05:26.310 --> 05:30.260 And I will not start the built in Kafka consumer. 05:30.480 --> 05:32.940 I will create the consumer using Python. 05:32.940 --> 05:34.020 And let's do that next. 05:34.030 --> 05:35.080 I'll see you in a moment. 05:35.100 --> 05:35.510 Bye bye.