We were able to successfully start the producer and produce hundred messages, and we did that two times,
and at the consumer we have ensured that we have received those messages.
And here in the terminal, we have seen meaningful logs.
And first of all, when producer starts, it generates such information with a set of parameters.
It has started a week.
But again, that we have specified only three parameters here.
They are most observers, key serializer and Waialua serializer.
And I have described what those parameters mean.
And no, let me briefly talk about some of the parameters.
I want to cover all of them, because there are many of them and a lot of them are actually used very
often in order to describe those parameters.
Let me go to the recommendation here.
And we have actually opened before producer conflicts.
And if you have not yet done that, please go to documentation and scroll down to the section configuration
of the producer.
A producer can fix this one and you'll jump to different parameters you are able to set for your producer.
Notice that for every parameter there is importance.
And I'll talk about parameters that have high importance.
Some parameters have medium importance and some of them have low importance.
OK, let's talk about parameters of this high importance in greater details.
We have already talked about serializer and various serializer, but let me quickly sum up what those
parameters mean.
They specify which serializer interface should be used in order to encode key and value and usually
key and value are strings.
But if you want to encode, for example, into you should use integer serializer instead of string serializer,
we will try the delay down.
Next parameter is acknowledgments and is default.
Timbalier is set the one here you'll see this information.
Default value is one and possible values are zero one and all.
Let me quickly explain what this value means.
And for that, let me quickly go to diagrams and find diagram where we have talked about leaders and
followers probably on this one.
Let me make it a bit smaller like this and let me explain what this parameter means.
Let's suppose that there is a topic with some protections and there is an obligation of factor configurator
at the topic level basics.
And for example, the application count is set to three.
That's how we basically configure to our top economic in this example.
And in such case, there was a leader and two followers and the leader is responsible for communication
with producers and consumers and it performs all right.
And really operations to specific Patison.
And those follow rules just synchronize messages with leader.
Actually, leader sends a copy of every message to each of the followers.
And in such case, every message will be copied actually two times it will be stored at leader in this
partitions zero and it will be copied to partitions zero to broker a zero and two partitions zero at
Broka two and no.
Let's get back to this parameter.
UX acknowledgments.
If it is set to zero, then producer will not wait for any acknowledgement from the server, from the
broker at all.
It means that every message will be just sent and that's it.
If there is some network outage or Breuker is not temporarily available to process this message, this
message will be simply lost.
And this way it does not recommend it to use the disk at all.
I mean, set equal to zero, it is recommended to use setting either one or.
Oh, let me describe the difference between equal one and equal all set in only leader of the partition.
In our case, Broecker one will send acknowledgement to producer after it will successfully write message
to specific partition in our example, partition zero.
But if you will use set in equal all this one, it will mean that leader will wait for a full synchronization
with followers.
In this example was Rocknroll zero and Broka two and only after it will receive acknowledgments from
or zero and Broecker two that they have successfully read a specific message to their partitions.
Only after that this Breuker leader for this partition will send acknowledgement to producer.
That's what they said in equal all means, and it is actually most fault tolerant and with such that
you will ensure that the message that is produced by producer will be written to Ledra and all sync
replicas.
That is the strongest available option among all of them.
Let's quickly go to our project and observe.
Well, of course, here it is, actually.
Here on the list, and you'll see here one, and that means that this producer will wait for acknowledgement
only from leader when a leader will write a specific record to specific protection grade.
Great.
This parameter.
OK, let's scroll down to next parameter buster observers.
That is actually mandatory and it doesn't have any default value.
That's why you need to specify at least one silver.
And in our example, we have specified actually three severals like this in the value we have separated
them using commas like this.
And here you see this parameter on the list and it shows us actually array of serros.
Great.
Next parameter is the buffer of that memorium.
And this parameter specifies how many Mamoru producer may use to buffer records that are waiting to
be sent to the celebra and default value is here.
It is equal to 32 megabytes and the importance of this parameter is ultra-high.
Next parameter compression type and by default there was no compression.
Here you see that?
And if I switch to our project, you'll see that here in this output as well.
Compression the type equal number.
And that means that there is no compression applied to while sending messages from producers to brokers.
And that's actually not good.
And it is always recommended to use compression in order to increase throughput.
And the same benefits and possible values are josipa snappy Elzy four and zesty radwaste parameter specifiers.
How many times producer will try to send the same message if there was some error and if it does not
receive acknowledgement from the leader?
If there was such sediq acknowledgment is set to zero.
It means that we don't wait for any acknowledgement.
Then a parameter actually doesn't matter and we simply send messages and that's it.
But if acknowledgements is set to one or all, then retries does matter and default value is here.
It is very, very large and producer will try to send every message many, many times.
And if l go to our project and scroll down, I'll find retries somewhere here.
Here was this.
Well, it is very, very large.
Great.
Let's proceed.
And the next parameter of high importance is actually as a cell configuration parameter.
And there was a set of such parameters and by default, connection between producer and the broker is
actually unencrypted and that's not always safe.
And if the brokers and producers connect over open Internet connection and someone might intercept messages
and the message of importance, then you should stop SSL encryption between producers and brokers.
And for that you need to use several parameters like this one and all for other parameters related to
configuration of SSL.
Next parameter I want to talk about here is that batch size is important is the medium actually.
And we have talked about all parameters of high importance, but which size is important parameter.
And let me talk about it right now.
Size is by default a 16 kilobytes.
And if I go here, you'll see both sides at the beginning of this output here as this parameter by each
size and its default value.
Sixteen kilobytes and thus forming Riquelme that we have sent multiple messages one by one, and we
have actually sent 100 messages.
And it would not be nice if we sent every of those messages separately.
A separate request to broker in such case that we need to actually 100 different requests and 100 different
packages.
That's not fair and it does not save several sources of brokers and does not efficiently utilize Ben,
because every separate packet of dissent has its own header and that actually decreases throughput.
And of course, it is not efficient.
That's why batch size is used and the producer will try to batch Rackers together into fewer requests
if it is possible.
If multiple records are sent to the same partition.
It is important, you know, that the partitions may reside on different brokers.
And that's why producer may batch of records to different producers that host different partitions.
And in general, if batch size is used, producer will send fewer packets and it will try to combine
multiple messages together.
But please note that in such case, messages may arrive a bit later after they were actually created
on producer because producer will keep them for some time in cash and not below that.
The small budget size will not make a batch and really efficient and it may reduce throughput.
But advantage of the small budget size is that the messages will be sent almost without delay.
They will be kept for a long time in cash.
But if.
There was a large bite sized configurable then producer will utilize memory and it may go out of memory
if there are really many messages waiting in a buffer and that's the way it is actually recommended
to keep default volume that is equal to 16 kilobytes.
But again, if you want, you could increase it and make it like a several megabytes if you want this
size.
There are also a bunch of other parameters.
If you have spare time, I recommend you to quickly go over this document and read about remaining parameters.
Actually lost parameter.
I want to talk about here is client ID.
This parameter is set to empty string by default.
And if I go to this output here, you'll see that.
Let me scroll up and find the client ID.
Here it is.
And using this parameter, you are able to specify custom idea of the producer and if there are many,
many different producers and if you want to know which producer has produced specific message, you
could add this parameter in the configuration of producer and then you will be able to track, request
and understand to which brokers send particular messages altogether.
That's all what I wanted to tell you about parameters you could configure on a producer level and all
of those parameters you could setup, same as we did with bootstrap servers.
Serializer and various serializer simply use probes to put their own name or parameter that there should
be equal to name specified here in documentation.
For example, delivery time out dot miles.
Then look which value is expected.
For example, for this parameter, we need to specify time out in milliseconds and default value is
this one.
It is two minutes and every parameter you specify here will override default values.
OK, that's all for this lecture.
And next, let's deforming.
Let's try to produce numbers, integers instead of strings here and see what we will get here in a terminal.
I'll see you next.
Bye bye.