WEBVTT 00:04.210 --> 00:09.310 Let's not modify message that the we are sending from produce, because now we send just number like 00:09.310 --> 00:13.960 this in order to do that, let's define how variable it will be between. 00:15.450 --> 00:22.290 String and name of the variable will be message, and here we could use format string and for that you 00:22.290 --> 00:26.610 could use the string glass and its method format like this. 00:26.880 --> 00:35.990 And here let's the type message itself, producer percentage sign, as has sent the message percent 00:36.000 --> 00:40.140 the same as at percentage sign like this. 00:40.420 --> 00:47.220 And here next, after the Commonwealth specify three different values that will be placed here on those 00:47.340 --> 00:55.920 places where we have added percentage sine s and first we'll be, let's say, producer client Edem and 00:55.920 --> 00:58.070 we could define it here about properties. 00:58.230 --> 01:05.660 Let's make it like this, Swingline, Edem, and let's make it equal to my desk producer. 01:06.000 --> 01:12.300 And also let's add new properties here below Ogg's probes to put. 01:12.300 --> 01:14.550 And here will be client ID. 01:14.640 --> 01:20.340 Notice that now it is empty, it is default value and here will be client ID like this. 01:20.910 --> 01:28.320 And also Lasserre, use this client, add below in our message and the here will be first client ID 01:28.350 --> 01:35.790 like this, next will be number of the message and we could use here I and actually this method should 01:35.790 --> 01:37.260 be defined inside of the loop. 01:37.260 --> 01:37.950 Sorry for that. 01:37.950 --> 01:41.580 Let me move it here like this and next actually will be. 01:41.580 --> 01:42.690 I like this. 01:42.720 --> 01:45.450 We don't need to convert to string here. 01:45.450 --> 01:51.990 It will require us to string and the finally let's add here date and let's simply use new date. 01:53.000 --> 02:00.460 Like this, and it will be imported here from Java deal and this all actually from massage and the now 02:00.470 --> 02:05.060 we're able to play is set to here instead of into Twinky. 02:05.360 --> 02:09.120 So remove it from here and add my variable like this. 02:09.590 --> 02:17.020 Also, let's put out the top economic growth from here and define it here, like this drink topic, 02:17.360 --> 02:19.530 and let's make it equal to twins. 02:19.640 --> 02:21.140 It will be the name of the new topic. 02:21.140 --> 02:28.670 We are able to create that right now and remove numbers from here and replace the label like this. 02:28.880 --> 02:29.300 Great. 02:29.480 --> 02:36.680 Let's also, instead of this line print simply massacre to terminal like this and let's not actually 02:36.680 --> 02:37.550 create a new topic. 02:38.030 --> 02:45.680 Let's go to list of commands here and let me create the new topic, same as numbers with file partitions, 02:45.680 --> 02:46.220 let's say. 02:46.400 --> 02:48.780 And here will be strings and replication. 02:48.780 --> 02:51.360 A factor will be the same as for number three. 02:51.650 --> 02:56.290 Let me you this command to go to terminal and let's create topic here. 02:56.540 --> 02:58.760 Actually in this type of consumer is running. 02:58.770 --> 02:59.710 Let's keep it running. 03:00.020 --> 03:04.700 Let's talk Afkham and let's create new topic string's here. 03:07.110 --> 03:15.060 It was created and now let's start this consumer and let's read topic instead of numbers will be string's. 03:16.720 --> 03:22.750 We started this topic is new and there are no messages at the moment, let's go to our application here 03:22.750 --> 03:24.790 and let's try to execute it. 03:25.150 --> 03:25.840 Let's run. 03:29.740 --> 03:37.210 And it seems that all went fine and all 100 messages that were produced and here you see actual contents 03:37.210 --> 03:42.700 of every message producer, my producer has sent messages, then a number of the message at and here 03:42.700 --> 03:49.570 you see that obviously all messages well sent almost simultaneously one by one, because we have not 03:49.570 --> 03:52.360 introduced any delay between messages. 03:52.510 --> 03:55.160 Actually, we could fix it quickly. 03:55.360 --> 03:58.720 Let me inside of the loop, add some delay. 03:58.900 --> 04:06.080 Actually, let's edit here after sending of the message and here let's use a delay like this thread. 04:06.190 --> 04:07.000 Don't sleep. 04:07.750 --> 04:13.750 And here number in milliseconds and let's leap, let's say three hundred milliseconds like that. 04:14.170 --> 04:16.720 And let's run around our producer once again. 04:21.340 --> 04:28.150 And now you see that messages are delayed and we actually sent three messages every second, let's wait 04:28.150 --> 04:29.830 until all of them will be sent. 04:30.040 --> 04:35.590 And meanwhile, we are able to go to consumer and observe whether it receives messages or not. 04:35.800 --> 04:38.230 And it seems it does not receive any messages. 04:38.440 --> 04:40.230 Probably I made a mistake. 04:40.240 --> 04:41.620 Yes, here is a mistake. 04:41.620 --> 04:46.040 And he specified the topics and this topic was created automatically. 04:46.450 --> 04:50.330 Let's actually quickly observe details of this topic that was created automatically. 04:50.530 --> 04:56.650 For that, let's go to list of comments here and let's read details about topic strewing. 04:57.340 --> 04:58.840 And let me read this comment. 04:58.840 --> 05:02.250 Go to terminal and read typing details here. 05:04.620 --> 05:10.800 And you'll see that this topic was automatically created with an application for DR1 and with partition 05:10.800 --> 05:16.530 count also one, it is default behavior and actually you are able to disable such behavior and disable 05:16.530 --> 05:19.810 all degrees of topics in the configuration file of the broker. 05:19.890 --> 05:25.530 For now, let's keep this topic here in place and recap that here we have started a consumer that listens 05:25.530 --> 05:27.950 to messages in between extortive my about. 05:27.960 --> 05:28.620 Sorry for that. 05:28.620 --> 05:33.270 And now let's go back to our application change topic named Two Strings. 05:33.510 --> 05:36.900 And let's now produce messages and our start producer. 05:38.800 --> 05:44.740 Well, it is run and we can go to our consumer and ensure that messages are received and yes, that 05:44.740 --> 05:49.360 is the case and message board is the same as produced by our producer. 05:49.750 --> 05:51.280 OK, that's all for this example. 05:51.280 --> 05:54.550 And the next, let's quickly summarize what we have gathered here. 05:54.700 --> 06:01.840 And afterwards we will move on and agreed the consumer class here in the same project and the consumer 06:01.840 --> 06:04.620 and observer some options and play with it. 06:04.750 --> 06:05.640 I'll see you next. 06:05.650 --> 06:06.100 Bye bye.