OK, let's go on, let's put this property props dot put the name of the property is Bootstrap.
Don't serros.
And the VELIA will be localhost.
1992, then at Commom and the type of localhost, the 1993.
And one more localhost, 1994, and don't forget to add semicolon here, great Worster observers, the
way I can figure out.
And now let's add the key and value serializer in order to do it more quickly.
Let me copy those two lines from here and paste the here and now.
Let me explain you what actually those serializer rules mean.
I have told you before that in Kafka, every message is actually a sequence of bytes and this sequence
of bias is sent by producers and consumed by consumers.
And as a result, every producer must know how to encode messages that it sends to Kafka.
Gloster and each Kafka consumer must also know how to decode messages that are received from Kafka clasper.
As you know, every message must contain value and optional key and keys and values and coded and decoded
separately.
And in this example, these encoder means that every key will be actually strewing.
Same relates to value.
Every well is expected to be a string.
And if you try to supply to this producer, Anambra, instead of string, it will be able to apply this
realisable because this serializer is used only for encoding into sequence of bytes, strings, not
numbers.
You are also able to use the or different serializer.
And now let me actually quickly show you which serializer are available for that.
Let's simply copied the serializer name.
Go to Google Chrome, open up new type of base to this here.
And let's also add Varosha number two DOT 4.0 in my case.
And let's click on this first link.
And here you may read the details about this glass doing realizing it is actually implemented in interface
serializer, and by clicking on this interface name, you are able to get URLs or possible serialize
URLs like Bitaraf, serializer by Bavaro, serializer along serializer, integer, serializer and so
on.
It means that you are able to use different serializer to encode keys and values that are sent by producer.
But the most commonly used serializer is this one doing Serializer Borst for keys and values.
OK, that's actually all mandatory parameters that we need to specify in order to be able to produce
some messages.
And next to let's create a new instance, our producer.
Let's go to our example here, Whatley's.
And we need to create a new instance of coproducer.
And as an argument, we will supply here properties that we have set up.
But please notice that here, instead of producer type, we need to use KAF coproducer type.
Let's go to our project and create producer.
Thus here will be Kafka producer.
And if you'll press enter while typing, you'll see that coproducer will be automatically imported from
Oracabessa Kafka, Glines Producer and Roquette that we have added this dependency to our Mavin project
here.
Great.
Next, we need to specify types of parameters, string and string.
Next will be the name of the variable.
And let's name our producer or simply producer like this, and it will be a new instance of a Kafka
producer.
And he'll let supply props as argument work that we have configured props here about awesome producer
was created and now lets, same as in this example, produce 100 messages simply as numbers like a zero,
one, two and so on.
And we will send Borski and well and we will use the producer record for that.
And instead of mitotic, let's produce messages to Dobek Gold numbers.
Please note that we have not yet created the topic numbers and we will do that in the next laubscher.
But now let's finalize our producer.
Let's go back to the project and let's keep it simple for a loop in order to create that quick list.
Type four and the select four I hear from dropdown for I like this and let's iterate from zero to let's
actually, instead of hard coding number here, use a variable like number of records and let's define
this variable here above and it will be in the number of records and let's assign value.
One hundred to you like this.
And here inside of this loop, let's produce method just using this producer producer and here we will
use sound method like this.
And here as argument for this method, we need to use produce set record.
And if you'll add apprentice's, you'll see this information here.
Great.
Let's not create a new producer record.
And produce a record is located in the same package as Gulf coproducer, and if you will select produce
a record here from the dropdown, you'll see that it will be automatically imported from the same package
as well.
And the he'll specify name of the topic.
It will be numbers in our case and the next we need to specify key and value.
While it is optional, let's specify for now Borski and value and let's use simply eyeballs for key
and value and vocab data we are using doing serializer.
This way we need to supply strings balls for key and value.
We could use I and the same as in this example converted to string like this use integer glass and it's
method to string and here I as argument.
Let's do it in Dajarra.
Door to door in.
And here will be I like this, it will be Kim and next will be Balya again integer dot to string and
here will be the same as for.
I like this and it's also produced.
The record will close it by adding semicolon.
And let's finally after this full loop at the end of this method, let's close our producer producer
Dot Glos without any arguments like that.
Great.
Our main method for producer Glass is ready and we are able to use it.
And let's do that actually next.
And next, let's create a new topic.
Now let's start building console consumer.
And afterwards we will try to start this producer.
I'll see you next.
Bye bye.