From the course: Apache Kafka Essential Training: Getting Started (2021)

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Producing and consuming data with scripts

Producing and consuming data with scripts

From the course: Apache Kafka Essential Training: Getting Started (2021)

Start my 1-month free trial

Producing and consuming data with scripts

- [Instructor] Continuing on the topic creation from the previous video. We will now publish messages and consume them using command line scripts for this use case. To publish data, we use the kafka-console-producer.sh. We specify the topic name as kafka.usecase.students. Since we are publishing with the key, we need to specify the parse.key parameter and the key.separated parameter. Let published some data now. Key would be 1001 and the values will be just a student name. Next, to consume messages from the topic we use the kafka console consumer. Again, we need to specify the printer key property and the key.separated property. We also can specify a group name to enable kafka to track consumption of data. On running this command, we see all the data that we have published so far to this topic, printer to the console. Now let's go and publish another record here. And we see that that record immediately shows up in…

Contents