So far, we have agreed that the new Mabern project intelligence and also we have started the new coffeecake
last hour here, Resor doorkeeper and here are three different brokers in the class.
Now, it's a good time to create producer and consumer in our project.
And we will start with creation of producer.
And without a doubt now it's a really good time to show you how to use Aperture Kafka documentation.
So please navigate to Kafka dot aperture dot org and the here select documentation.
And on this page you'll find documentation of four different KAF commercials at the moment of recording
of the scrolls.
The last version is 2.0 and the version I am using in this scrolls.
And that's why I'll use this documentation version.
If you use another version, please the choose your version for your setup here.
Below, you may find different sections how to get started, the different APIs, different configuration
settings, design, implementation operations and so on.
Really, really much information related to our project outcome.
But what we are going to use here in order to build our sample producer and consumer.
First of all, we will use producer API and Consumer API.
Also, we will use producer confidence and consumer confidence.
Let me throw open producer API in a separate step like this.
And then this step in producer ABI section, you may find another link to examples that show how to
use producer in Java.
Let's open up this link in a new tab as well.
And also here on this page, you'll see that in order to use producer in Java, you need to install
following Maimon dependency.
And that's what we are about to do right now.
Let's go to our project and go to Bombed-out example file.
And here in the project section, along with version of properties, the group idea and so on, you
should add dependencies.
And in order to quickly add the new dependency, you can Prosky combination of government control and
like this and select dependency.
And here in the search bar, you are able to search for specific dependency.
Let's go to Google Chrome and the name of our dependency is Coffeecake Lions, and it is located in
Oregon up Jadot Kafka.
Let's search here simply for Kafka like this.
And here in the search results, you'll basically find coffeecake lines as a froster result.
Let's expand it and you should select the version that is compatible with your installation.
And I'll select this one version 2.0 and click at.
And you'll see that intelligence will automatically add new dependancy to our project.
Also, you have seen that for a short period of time.
Those things were in red.
And that's because someone was actually downloading this dependency.
And again, we will use the Kafka Lines API, both for producer and consumer.
Great.
Let's go back to documentation.
And here, let's open up this example that will show how to create a new producer here.
You're able to scroll down and find the actually basic example on how do Loung basic producer and obviously
we need to have a Kafka Gloster up and running before starting a new producer and same as we did in
Kafka console producer.
We need to specify bootstrap Sarovar at least one, for example, in this case that there is default
Sarah with default settings.
And also we need to specify a topic we want to produce messages to.
And in this example, topic name is my topic.
This are actually two mandatory settings and also we need to specify key and value serializer.
I'll explain to you what is that just in a minute.
Also, accept those properties that you are able to set for producer.
You could set to many, many hours or different properties.
And before starting with our own producer Glass, let me show you how to find out where properties allocate.
Please go to documentation tab and the here scroll down to producer conflicts.
Let me open it up in a new tab.
Go down.
And on this page you may find all settings you are able to use along with your producer.
And this page is useful because you are able to find out how properties are called.
For example, here is a proper deal was named Guidotti, Serializer and Özal property name is Hox and
if you scroll down you'll find the Bootstrap Ozawa's.
It is actually mandatory property and accept that there are many, many different properties like compressional,
the type or Dryas SSL dot keystroke, that password and so on.
Many, many different properties.
And I will not explain every property in the Dales, but I'll try to focus on mostly used of them.
Great.
Let's now go to our project and let's create the very first example of our producer based on this example.
OK, so let's go here and in Java folder, let's create a new class and name of the class will be a
producer.
Right mouse click select Java class and type name producer like this press enter and new class will
be created here.
Lets is usually create main method they main and press enter.
And first we need to initialize new instance of properties.
Let's use properties class and if your type properties and afterwards press enter, you'll see that
the intelligence will automatically import properties from Java DOT ordeal and let's name properties
like probes and we will initialize this variable simply like these new properties and no arguments at
SEMICON and no probs variable is available for use.
Let's now put some properties and mandatory properties are bootstrap sevres key serializer and values
serializer.
Our property is optional.
Hence let's specify these properties, bootstrap those Sarahs and notice that in this example there
was just a single Sarah.
But we have three Saras in the Glouster and I recommend you to specify all of them in this property
because in case you specify only single server, you will be still able to connect to entire Glouster
and produce messages to all serros.
But in case this single fails, you will not be able any more connect the entire cluster and you will
not be able to produce any messages.
That's why for redundancy, I highly recommend you to specify at least a two or three serros from your
colostrum.
Let's not make a short break and proceed next.