WEBVTT 00:04.420 --> 00:10.150 In the previous examples in this section, we have agreed that producers that can produce must adjust 00:10.150 --> 00:13.570 to any topic and we have agreed that topic numbers for that. 00:13.720 --> 00:16.450 And this producer produces 100 messages. 00:16.840 --> 00:22.960 And in the configuration of this topic, we have specified that we want to have five different partitions. 00:22.960 --> 00:30.160 And basically we have seen that all managers are spread across the partitions from zero to I.D. form. 00:30.680 --> 00:36.910 Also, we have agreed that to several consumers like consumer was out to commit, consumer was may not 00:36.910 --> 00:39.730 commit and consumer with protections assignment. 00:40.180 --> 00:46.090 And in the last example, we have assigned consumer only to several partitions. 00:46.630 --> 00:52.870 But now in this example, let me demonstrate you how we are able to launch multiple instances of the 00:52.870 --> 00:59.590 same consumer, and that will mean that we will have multiple consumers that will belong to the same 00:59.590 --> 01:00.540 consumer group. 01:00.970 --> 01:06.280 If I open, for example, this file consumer was able to commit, you'll see that we have specified 01:06.280 --> 01:09.700 that those settings put the group ID through the group. 01:09.940 --> 01:13.000 That means that this is the consumer when to start. 01:13.000 --> 01:16.810 It will belong to consumer group called Thralls Group. 01:17.320 --> 01:23.410 Basically, we have specified the group in area of those consumers and if you'll open this one here, 01:23.410 --> 01:26.150 you'll see a second group and if you'll open up. 01:26.150 --> 01:31.750 But this consumer with protections assignment, you'll find the third group here as well. 01:32.170 --> 01:38.410 But in this example, let's reduce the consumer that we have agreed to before this one consumer was 01:38.410 --> 01:39.160 out to commit. 01:39.790 --> 01:46.390 But in order to be able to start multiple instances of the same consumer, of the same process, actually, 01:46.690 --> 01:48.970 you need to to modify settings. 01:49.240 --> 01:56.410 You need to go here, click edit configurations and select here consumer with without to commit this 01:56.410 --> 01:56.710 one. 01:57.100 --> 02:01.750 And afterwards check this checkbox alow borrow from this one. 02:02.080 --> 02:06.220 And after checking this box, you need to click, apply and locate. 02:06.610 --> 02:13.690 Please note is that if you don't see consumer was able to commit here, you need to start this consumer 02:13.690 --> 02:14.560 at least once. 02:14.650 --> 02:19.510 Just a click here and select the one main method of the consumer without a computer class. 02:19.780 --> 02:25.660 And basically let's now start to our thralls, the consumer that will belong to thralls group. 02:25.840 --> 02:27.340 And let's click here. 02:27.370 --> 02:28.690 Run like this. 02:30.130 --> 02:36.350 Consumer is running now let's start one more instance of the same consumer and same as before. 02:36.370 --> 02:37.210 Click here. 02:37.270 --> 02:43.270 And Ron, main method of this class and notice that this process will be started in a separate app. 02:43.270 --> 02:46.660 And now we have two different consumers up and running. 02:47.110 --> 02:52.090 And no, it's a good time to start our producer and produce just two topic numbers. 02:52.400 --> 02:56.590 Let's go to producer and let's run its main method. 02:59.880 --> 03:06.570 Producer has successfully sent 100 messages, and now let's go to the consumer and verify which messages 03:06.570 --> 03:07.440 it has received. 03:07.680 --> 03:15.380 And in my case, I see that this consumer has received messages from Patison with a form and partition 03:15.390 --> 03:16.370 with Idear three. 03:16.560 --> 03:20.160 And if I grow up, I will not see any of the partitions. 03:20.160 --> 03:27.240 And that means that this consumer was allocated only two partitions partition beside three and partition 03:27.240 --> 03:28.190 with a default. 03:28.590 --> 03:34.980 If I go to second, tap this one and observe which messages this consumer has received, I'll see that 03:35.100 --> 03:39.210 it has actually got messages from all remaining partitions here. 03:39.210 --> 03:41.160 I see partition with ID one. 03:41.460 --> 03:47.940 Next I will see partition with added to and I also should see partition with a zero. 03:47.940 --> 03:56.070 And if it is the case and that means that our Kafka cluster has allocated three partitions to this consumer 03:56.310 --> 04:03.030 and the two partitions were allocated to this consumer in order to find out which partitions were assigned 04:03.030 --> 04:08.790 to different consumers, we need to use a command that will give us details about specific consumer 04:08.790 --> 04:09.150 group. 04:09.390 --> 04:15.570 And in our case, we have used the consumer group with name first group in order to quickly find this 04:15.570 --> 04:16.710 command and reuse. 04:16.710 --> 04:24.180 It does go to our GitHub repository, go to examples folder and select example consumer groups and let's 04:24.180 --> 04:27.510 open up this text file with all related commands. 04:27.690 --> 04:33.860 And the here somewhere at the end will be command that will lead to the tales of specific consumer group. 04:34.140 --> 04:39.630 And here we need to replace this group name with name in our case for the group. 04:39.630 --> 04:40.750 Let me copy. 04:40.770 --> 04:44.250 Throws the group from here and replace Namath's with Ferrol, the group. 04:44.640 --> 04:46.260 Let's leave here single Sara. 04:46.380 --> 04:53.520 Copy this entire command, open up a terminal window and here ensure that you are in a folder based 04:53.520 --> 04:55.050 command and presenter. 04:57.300 --> 05:04.710 And here, I'll see how different the partitions were assigned to different consumers, and in our case 05:04.710 --> 05:07.730 at the moment, we are run in two different consumers. 05:07.740 --> 05:08.530 Here they are. 05:08.730 --> 05:12.720 And I should see two different the consumer IDs here in the least. 05:13.020 --> 05:19.800 And here I see first consumer ID is assigned to partition zero and the same consumer is assigned to 05:19.950 --> 05:24.210 partition with ID one and with ID to hear is. 05:24.570 --> 05:30.450 Please notice that in your case, assignments will be completely different and to remain in the partitions, 05:30.450 --> 05:37.250 partitions with ID three and ID four assigned to another consumer with such ID. 05:37.740 --> 05:43.920 That's how partitions will spread across the two different consumers that are currently running in our 05:43.920 --> 05:44.420 setup. 05:44.940 --> 05:45.700 Let's not default. 05:46.170 --> 05:49.370 Let's start one more instance of the consumer. 05:49.380 --> 05:53.820 Same consumer with all the commit in the same consumer group therapist group. 05:54.240 --> 05:56.970 Let's click here again Romdhane method. 05:57.210 --> 06:02.310 It will be started in a new tab and now I have three different consumers up and running. 06:02.610 --> 06:07.170 And now let's go back to terminal and execute this previous command. 06:08.270 --> 06:14.480 Described by the group, a consumer group, and now I should see three different consumers on the list. 06:14.510 --> 06:15.770 And this is the case. 06:16.130 --> 06:22.380 This consumer is now assigned just to two different positions with least two and three. 06:23.090 --> 06:30.950 This consumer was assigned to partitions with zero and one, and new consumer was assigned to Patison 06:30.950 --> 06:32.060 with a default. 06:32.300 --> 06:33.680 And that's completely fair. 06:33.860 --> 06:39.800 All participants were equally spread across three different consumers to two and one. 06:39.800 --> 06:41.510 Patison Wonderful. 06:41.690 --> 06:48.110 Let's now go back to our project here and the stuff the producer once again, Ron, it's the main method. 06:49.010 --> 06:54.530 And we should see that this last consumer will get the messages only from a single Patison. 06:54.530 --> 07:01.340 Again, in my case, it was assigned only to partition with ID for here I see this in output in time 07:01.790 --> 07:04.530 and the same information I see here in this output. 07:05.150 --> 07:05.710 Wonderful. 07:05.900 --> 07:12.110 That's how you're able to create different consumers in the same group and delonge them in parallel 07:12.500 --> 07:13.190 if you want. 07:13.220 --> 07:20.510 You could experiment and delonge your two more copies of those consumers and verify that each of them 07:20.510 --> 07:22.720 will get just a single partition. 07:23.000 --> 07:26.840 And afterwards you could try to start one more consumer. 07:26.930 --> 07:33.140 It will be six consumer and you'll see that inside the top one of the consumers will be idle and will 07:33.260 --> 07:35.220 be assigned any partitions at all. 07:35.900 --> 07:37.160 That's all for this example. 07:37.160 --> 07:39.410 And next, you'll get short challenge for you. 07:39.530 --> 07:40.160 See you next. 07:40.170 --> 07:40.660 Bye bye.