OK, let's go one was configuration of the consumer and actually let me first create the track edge
blocker, here will be a dry block, then get here will be exception.
And here, if something went wrong, let's bring this exception e bring the stack trace like this.
And finally, same as always, producer, we need actually to close consumer consumer, not close like
that.
Wonderful.
And the here in a drive.
Look, let's add the infinite loop like in this example.
Actually, let me copy it quickly from here and the place to our project like that.
And after you have pasted the section, you'll see that those glasses are highlighted in red and that
means that they are not important automatically.
And in order to input, each of them are simply hover miles over specific glass and the glass.
This consumer, because glass was important.
Same way you should do with durational glass.
It will be imported from Java Time, less important as well.
And let's also import consumer record glass, import glass, if you will scroll up, you'll see all
of those imports here at the beginning of the file.
And actually we're able to reduce the size of those imports and simply instead of three records here,
import everything from consumer.
And the here will simply start out like this wildcard import and saying we could do with Java or deal
imports or remove this one and simply replace here with stuff like that.
Great.
Let's go back to our infinite loop.
Notice that here we use condition.
True.
And this means that this whale will be running until you manually exit from the programme.
Let me actually quickly refactor it to and first, let me explain to you what happens here.
Every one hundred milliseconds we pull brockers and we get new records, if any.
And if there are some records, we loop over those records.
And afterwards you could perform any actions with the records you want.
And in this example, parts of each record, like of said the key and velia formatted and the printed
to terminal.
And as you'll see, each record has such Mathilde's as offset the key value and looking actually at
his block of statements like this and the inside of it, the lethargically on your variable message,
string message and live here use format, method of the string string format.
And here, let me simply copy antiapartheid here, indorse parentheses like this and paste here and
afterwards let's simply use a studio and print message to Tamina like this and I don't need this line
anymore.
Great.
That's actually all what we need in order to get some meaningful output from this first consumer.
And let's actually try to start it.
Let's start the main method of the consumer class.
Let's run it.
And it seems I got an error unable to commit to cannot be such a wonderful group I.D. now is used and
that means that we are actually not able to use our to commit without customer consumer group I.D..
Let's actually fix that unless specified group ID here, broad support group ID and let's make it equal,
for example, to a group like that.
And now it should work.
Let me expand this window and let's aronne consumer.
And it seems that now consumer was successfully started and now it polls for Numata just every 100 milliseconds,
and if you scroll up to the beginning of this output, you'll see a set of parameters that were used
for the start of this consumer.
And for example, here you see array of bootstrap scenarios that we have set up here on this line.
Also, you see all the comet intervale also enable our to option is set to drop and the group ID is
set to first group.
Great.
Let's not actually start our producer and let's produce some messages to no storbeck because here we
have subscribed to no Storbeck.
Let's go to producer.
Make sure to change your topic name to numbers and let's uncommented our first example, this one like
this.
For that, you need to press a command and forwards and let's comment all this example to like this
and let's start our producer.
Let's run my method here.
It will be started in separate type like this, and you'll see that 100 messages were sent and afterwards
producer has exited.
Let's go to consumer.
And yes, so we see here actually 100 messages that were just consumed and each message was formatted
like we specify it here on this line and we see here offset set for each record.
And, well, we used here three methods of the record.
And you'll see, for example, that this message got offset number 106 and Eskil was 65 and Waialua
is also equal to 65.
And actually, let's modify this to and let's also add information about partition.
And for that, you could use a record dot partition method that's add it here at the end, a record
dot partition like this.
And it will add information about partition and lengths also included here in Vermont and here, let's
type partition equal sine percentage sine s it will be between and let's restart our consumer and afterwards
let's produce one more hundred messages by producer.
For that, let's go to consumer and the press on this button that will run consumer.
It was restarted and now it is waiting for messages.
Let's go to producer Deb and let's start at over.
OK, messages well sent.
Let's go back to consumer and now we see all this information about partition of said well and partition,
but it seems that I have screwed up with formatting and I need to move a line break character from this
place to the end of the formatted screen and left or around consumer once again.
And let's talk producer once again as well.
Let's go back to consumer.
And now we see nicely four messages, and each of them contains information about offset key value and
partition, that our topic numbers was created with five partitions.
Let me go to our configuration of the topic, and here it is.
Here is how we agreed that the topic swings.
But in the same way, we have agreed that topic numbers.
And if you'll go here, you'll see that the messages were spread across different partitions.
For example, here you'll see a partition number two here with partition number three.
Next, if your school appeals information from other partitions and notice that the consumer actually
has consumed messages in batches.
It means that it has received a set of messages from each partition.
And here in the output, you clearly see that order of the messages is different from the order.
How they were produced by a producer.
Is because, again, they were produced to different partitions and they were consumed from different
partitions.
But if you have a look at the messages that were consumed from a specific partition, for example,
from partition with a one, you'll see that of sets of all those messages arranged by offset.
No, that's because all messages in each partition are stored one by one with in command of sets.
And here you clearly see that wonderful.
That's all for this first example where we have actually connected to the cluster of brokers and the
where we have received information from the topic numbers we haven't figured out to commit.
And all the commitments are just us.
And every second and also we have configurator, consumer group, Edem.
Great.
That's all for this example.
And next to let me go back to documentation and let me quickly make an overview of most important parameters
that you could set up at a consumer level.
And for that, let's go to the recommendation.
Here, scroll down and let's choose consumer to fix this section and let me make a quick overview of
most important parameters next by by.