So far, there are few partitions in our topic numbers, and there are currently three different consumers
running here, here and here.
And now let's try to increase quantity of consumers to six that will be larger than quantity of partitions
and see what will happen and how partitions will be reassigned to different consumers.
So let's copy our command that will start a new consumer in a group, NOM's, and let's open up three
more tabs like this city to Kafka.
Launch consumer.
Do I get him open up one more step to Afkham?
Start one more consumer, and at the moment there are five consumers running that is equal to quantity
of partitions in topic numbers.
And before starting one more consumer, let's go to group the Dales and read them and see how partitions
are now assigned to different consumers.
And you could guess that every consumer should be assigned to just single partition.
And yes, that is the case.
I see here five different consumer ideas, and that means that every partition is assigned to separate
consumer with separate consumer ID and it is completely fair.
There are five consumers in the same group and that's the way each of those consumers gift, just a
single partition.
And if I produce some additional messages now, let's say 14, 15, 16, 17, 18, then all those messages
will be spread across different partitions and every consumer will get some of those messages because
every consumer is assigned to a single partition.
OK, let's now try to start one more consumer in the same group and see whether a picture here in this
column will be changed or not.
So let's open up New Tab City to COFCO.
And start one more consumer here.
Let's drag it here and let's know details about our consumer group, NOM's Rexach U.S. Command.
And I see a different picture.
And as you may notice, politicians were reassigned to different consumers and for example, this consumer
with this idea that ends with fifty five was before assigned to partition one, but now it is assigned
to partition two.
So here was this assignment.
Also, you may see that in my case, the consumer with this idea that ends with five, four, six was
disappeared here from this list.
And that means that this consumer is no idle.
It does not connect to any of the partitions.
But if any of those consumers will stop, then this consumer with this idea will start consumption instead
of it.
So this is actually a redundancy.
But as you may see from this output, main outcome is that if quantity of consumers in a consumer group
is larger than quantity of partitions, then some of the consumers will be idle and they will protest
any of the messages, this idea behind distribution of partitions across different consumers.
And if, for example, you create a topic with, let's say, three partitions, but start one hundred
consumers in a group, then ninety seven of those consumers will be simply idle and won't process any
single message because maximum, in case you have only three partitions, only three consumers in a
group may be active.
Let's not try to stop one of consumers and see whether a picture will be changed here.
So let's stop, for example, this one.
You can stop any of six consumers and the go back here to this step and execute this command and rary
details about consumer group.
And I see that in my case, this consumer with this idea that was active at this moment of time and
has disappeared here from the list is now again active.
And here you see this assignment.
Now it is assigned to partition with a default.
But on the other hand, consumer with added that the ends with zero e this one in my case has disappeared.
And does the consumer that I have stopped here in this step, that's how we have just ruled on practice,
how idle consumers back to work if there was empty space for them.
Let's not stop one more consumer, for example.
This one, let's stop it.
Go by here, Rorem.
And now we should see that the one consumer is assigned to two different partitions.
And yes, here was this consumer with this idea, because now I have only four consumers and five partitions.
That's why two partitions must be assigned to a single consumer grade.
That's how consumers work in a consumer group, and that's how partitions are assigned to different
consumers in the same group as you see from this example in all outward.
So we've got like equal to zero, and that means that all consumers are able to consume all just in
time.
And there is no difference between current offset and look and of set numbers.
And the reason for that is that we have produced just several messages.
But if quantity of messages that are produced by producers is much, much higher and consumers are not
able to get all just in time, then here you'll see it non-zero numbers.
And that's what we will try in the next example.
But for now, let's quickly summarize what we explored in this example.
But let's do that next by by.