Now, you should have a python installed on your computer and we are able to proceed.
Let's open up a list of commands and quickly start the zookeeper and the calf Cabral girls, if you
don't have them up and running already.
Let me select this command, go to terminal.
And here I have actually prepared several steps in order to start the zookeeper and I'll broadcast more
quicker.
So here is the zookeeper.
Next comes throws the breuker with a desirable.
Also, please make sure that you have copied Sarah configuration files from this example to config folder
in Kafka.
OK, let's go to the next step, Bastante, and that is to broker a procedure is the same as in previous
sections and you could safely skip it and move the next lesson if you have already all broken up and
running and the last broker with 82 will be started in this last step.
OK, now we are ready to proceed and let's create the new project for Python files.
I'll create that on the desktop.
Let me go there and here on the desktop.
I'll read your folder with name Sublett Kafka.
Like this and the here inside I'll create the two new files producer Tobii and the Consumer API.
But let's do that.
Individuals to the code.
Go down, open our project from here, go to desktop or select Kafka.
Click open.
And here, let's create two files, producer Dobi and the Let's Create the Consumer don't buy as well.
Let's also install recommended extensions here.
Let's click on this button installing.
Extensions were installed and let me close those two pop ups and now let's start by creating a producer
and we will use a library called the Kafka Python.
Let me show you quickly.
Let's open up new tab here and type Kafka.
Python and FirstLine will lead you actually to the page where you are able to read about this Python
client for Obayashi Kafka.
And of course, here are several examples below and deferrals to what we need to do is to install a
Kafka Python and let's install the globally on a computer.
I will not use those environments.
I don't want to overcomplicate this example.
I launch a consumer and producer using Python three this way.
Instead of this comment, I'll use the IP three.
It is a package manager, a third version of Python.
Let me go to a terminal and here in this step and pipe three install Kafka Python like soul.
And we got an error, couldn't install the packages due to environment error.
Permission denied.
Let me try to do the same using Sudam.
Let me spend it with pseudo.
Enter my password.
And no, Kafka was installed successfully and now we are ready to use it.
Let's go to our project, Individual Studio Gold, and let's first grade producer.
And it is pretty simple.
We should throw the import Kafka coproducer from Kafka package like Saul from Kafka Import Kafka producer.
You could use autocomplete here step and the next let's create new producer.
Producer equals sign Kafka producer.
And here you need to specify mandatory parameter, same as for other APIs.
And you could guess that it is a list of bootstrap servers.
So here type parameter name would strap underscore salaries and you could use either a single server
and in such case you could simply type here localhost 1992 like Seoul, or we could use array of servers
for greater redundancy.
Let's use here array of centers like Seoul and let me copy this Celeron and the paste it here two times
and the change boards here will be 1993 and the here will be 1994 like that.
Next we are able basically to send messages using a coproducer send method producer the sent and here
comes the topic name and let's send the message to test.
It will be created automatically if we have not yet done that manually.
And the next comes message and actually we are able to convert stream to buy it directly here using
the following syntax.
B and next comes a string and let's send a message.
Hello from the Python producer like this, that's all what we need to do in order to create a basic
producer in Python.
Let's save this file, open up.
And by the time and now control McTigue and let's finally start our producer using Python three for
that type of Python three.
And here, name of the file producer PUA Press enter.
And it seems that the program was executed successfully and message was sent to test topic, but in
order to verify that this message has actually arrived to the topic, we need to start consumer and
start consumption of the messages.
And I will not start the built in Kafka consumer.
I will create the consumer using Python.
And let's do that next.
I'll see you in a moment.
Bye bye.