Let's not modify message that the we are sending from produce, because now we send just number like
this in order to do that, let's define how variable it will be between.
String and name of the variable will be message, and here we could use format string and for that you
could use the string glass and its method format like this.
And here let's the type message itself, producer percentage sign, as has sent the message percent
the same as at percentage sign like this.
And here next, after the Commonwealth specify three different values that will be placed here on those
places where we have added percentage sine s and first we'll be, let's say, producer client Edem and
we could define it here about properties.
Let's make it like this, Swingline, Edem, and let's make it equal to my desk producer.
And also let's add new properties here below Ogg's probes to put.
And here will be client ID.
Notice that now it is empty, it is default value and here will be client ID like this.
And also Lasserre, use this client, add below in our message and the here will be first client ID
like this, next will be number of the message and we could use here I and actually this method should
be defined inside of the loop.
Sorry for that.
Let me move it here like this and next actually will be.
I like this.
We don't need to convert to string here.
It will require us to string and the finally let's add here date and let's simply use new date.
Like this, and it will be imported here from Java deal and this all actually from massage and the now
we're able to play is set to here instead of into Twinky.
So remove it from here and add my variable like this.
Also, let's put out the top economic growth from here and define it here, like this drink topic,
and let's make it equal to twins.
It will be the name of the new topic.
We are able to create that right now and remove numbers from here and replace the label like this.
Great.
Let's also, instead of this line print simply massacre to terminal like this and let's not actually
create a new topic.
Let's go to list of commands here and let me create the new topic, same as numbers with file partitions,
let's say.
And here will be strings and replication.
A factor will be the same as for number three.
Let me you this command to go to terminal and let's create topic here.
Actually in this type of consumer is running.
Let's keep it running.
Let's talk Afkham and let's create new topic string's here.
It was created and now let's start this consumer and let's read topic instead of numbers will be string's.
We started this topic is new and there are no messages at the moment, let's go to our application here
and let's try to execute it.
Let's run.
And it seems that all went fine and all 100 messages that were produced and here you see actual contents
of every message producer, my producer has sent messages, then a number of the message at and here
you see that obviously all messages well sent almost simultaneously one by one, because we have not
introduced any delay between messages.
Actually, we could fix it quickly.
Let me inside of the loop, add some delay.
Actually, let's edit here after sending of the message and here let's use a delay like this thread.
Don't sleep.
And here number in milliseconds and let's leap, let's say three hundred milliseconds like that.
And let's run around our producer once again.
And now you see that messages are delayed and we actually sent three messages every second, let's wait
until all of them will be sent.
And meanwhile, we are able to go to consumer and observe whether it receives messages or not.
And it seems it does not receive any messages.
Probably I made a mistake.
Yes, here is a mistake.
And he specified the topics and this topic was created automatically.
Let's actually quickly observe details of this topic that was created automatically.
For that, let's go to list of comments here and let's read details about topic strewing.
And let me read this comment.
Go to terminal and read typing details here.
And you'll see that this topic was automatically created with an application for DR1 and with partition
count also one, it is default behavior and actually you are able to disable such behavior and disable
all degrees of topics in the configuration file of the broker.
For now, let's keep this topic here in place and recap that here we have started a consumer that listens
to messages in between extortive my about.
Sorry for that.
And now let's go back to our application change topic named Two Strings.
And let's now produce messages and our start producer.
Well, it is run and we can go to our consumer and ensure that messages are received and yes, that
is the case and message board is the same as produced by our producer.
OK, that's all for this example.
And the next, let's quickly summarize what we have gathered here.
And afterwards we will move on and agreed the consumer class here in the same project and the consumer
and observer some options and play with it.
I'll see you next.
Bye bye.