Before starting with our Stapel, let's quickly adjust to this Kafka Commons file and notice that it
is available in the corresponding example folder and the example is called Consumer Groups.
It is example number from and it doesn't require any custom configuration files.
That's why here you'll see only just a single file.
So let's adjust the topic that we will use here in this example.
And instead of Testor, we will use topic numbers.
So let's replace test with numbers like Solt, replace all and also will greet the customer group,
Gold Numbers Group.
So here in the segment where we will start consumer in specific consumer group, we will specify group
name and the here will be name numbers.
This group also, when we will read the consumer group details, we will specify also the name of the
group numbers.
That group like this.
Great.
Let's save this file and let's not start a storekeeper.
Let me copy this command to go to Scaffolder as usually and based command here.
Opened up a new tab and here, let's start just single brolga and get noticed that we will use the default
configuration file located in Quantic folder.
We don't require any cost on file for that.
So let's send it to COFCO and let's place this command here and start our single Breuker wonderful.
This Breuker was started and its ID is default one.
It is zero.
Let's open up a new tab city to Kafka and let's create our number.
Storbeck and the let's.
I just wanted the opposition to file and the obligation factor will be of course, left by default.
One, because we have only just a single Breuker in the last hour.
But that's completely fine for the purposes of this example.
OK, let's select this segment and let's create topic gold numbers.
Topic was created, and now if I list the topics in Kafka, Gloucester, I should see this topic on
the list and yes, here on this great let's not start the producer and the consumer without consumer
group so far and let's produce some messages.
So let's clear terminal here and here.
I'll be running coproducer.
Let's go up at this command based here and it will start producer where we will be able to produce mass.
Just two topic numbers.
Also, let's start the console consumer as before without specific consumer group.
So let's select this command, go to New Tab City to COFCO and start consumer.
Consumer is running and now let's try to produce some messages.
And here let's simply produce numbers like one, two, three.
That's enough.
Let's go to consumer and here we should see all those numbers.
Wonderful.
Let's keep the consumer and producer running and let's open up new tab and let's try to list all consumer
groups that currently exist on the Gloster.
So Sedita COFCO go to list with comments and scroll to this comment that will list all consumer groups.
Let's select this comment.
Go here based.
And now you should see single consumer group with such name, in your case, this number will be different
from mine.
Let's not do the following.
Let's try to lowish one more consumer, same as we did here in this example.
So please keep this consumer on.
Let's open up new tab, sorry, like Seoul and the here city to COFCO.
And let's start now our consumer without iGate Customer Group like this.
So copy this command post here and now as our consumer is running, let's produce a couple of emails
or messages like four and five.
And both consumers should receive those messages.
So here you see those two messages and here you'll see them as well.
Now, let's go again to this last step where we have listed to all consumer groups and repeat same command.
And now you should see two consumer groups and yes, here they are.
And that means that for every of those consumers that we have started in different tabs, different
consumer groups where we greed and purpose of creation of consumer groups in Kafka is actually reducing
of loda on consumers.
So let's imagine that there was a topic that has multiple producers that produce messages to it.
And throughput is really, really high and it gets thousands of messages per second.
And if there was just a single consumer, this consumer will be able to survive under such high alert
and that we won't be able to process all those messages in time.
That's why you are able to create a group of consumers that will consume messages from the same topic
and messages will be spread across different consumers.
So every consumer will get part of the messages in specific topic.
And in such case, load on every consumer will be greatly reduced.
That's actually the purpose of creation of consumer groups.
And as you see, by default, every consumer must belong to a specific group.
And if you don't specify group yourself, this group will be created automatically.
And now we see that the two different consumers belong to different consumer groups.
Great.
Let's all-Clear clear terminal here and go to list with comments.
And let's not try to read the details about the specific consumer group.
It is the last command here on the list and here in group option, you should specify the name of the
group.
Actually, I need again list groups here in order to get the number of specific groups.
And you could copy any of those names.
Let me copy this one.
Go here and here.
Instead of no group, let me temporarily place the name of this group and select this command and based
here.
And now I see the tales about specific consumer group.
Let me make it a bit smaller and try to feed it to the screen like this probably.
And here you'll see if all the information, you'll see group name, you'll see topic, you'll see partition
can't offset a look and offset and so on.
I'll explain each of those columns a bit later when we will start the consumer in a cost on consumer
group.
But now I just want to point your attention to the fact that here in this output, you'll see information
about all partitions in specific topic.
So at the moment, our consumers are listening to messages in topic numbers.
And that's why here you see topic numbers and all five partitions that we have created for this topic.
And for each partition you see idea of specific consumer debt.
Currently, consumers matter just from it.
And in such case, you see here the same idea, same consumer idea that was created automatically for
all partitions.
That's because at the moment we have just a single consumer that consumes Matha just from all partitions
in topic numbers, if you repeat same command, but use here and now as a group or accept that there
are currently two different consumers around.
And in my case, I could replace this number with this number one three one one zero.
And with the tales about that group, you should see a similar feature.
Again, topic is numbers.
Here you see another group with this name and the consumer idea is different, but it is the same for
all partitions in this output.
And again, it indicates that there was another consumer that is currently connected to top economic
growth and reads messages from all partitions.
So again, consumer ID here is the same for all partitions.
There's details about the consumer groups that were created automatically when we have started those
two consumers.
Wonderful.
Let's now stop this consumer and this consumer like so and let's try to read the list of consumer groups
again.
Let me clear Terminal four now, make it a bit larger and go back in history to the command to where
we have leased it to all consumer groups and press enter.
I still see the same consumer groups, but if you repeat same comment a bit later, those consumer groups
will be disappeared.
If I try to start consumer once again, for example, let's start this consumer once again.
Let's do that with the same topic numbers and go here and repeat this comment that will list all consumer
groups.
You'll see one more consumer group that was again created automatically for another consumer, because
technically this consumer is brand new consumer.
And if you specify option does this from beginning, you should get old messages that exist in topic
numbers.
OK, let's not stop this consumer and the close to doorsteps with consumers.
And actually let's close this tab as well.
And the next day, let's create custom consumer with customer group name.
So let's proceed in the next lecture.
Bye bye.