Leave your original terminal running. To consume the output events from each of the topic, you’ll need to open several new terminal windows. In each instance, the prompt will hang, waiting for more events to arrive. To continue studying the example, send more events through the input terminal prompt. Otherwise, you can Control-C
to exit the process.
First, to consume the events of drama films, run the following:
confluent kafka topic consume drama-acting-events --from-beginning --value-format avro
This should yield the following messages:
{"name":"Meryl Streep","title":"The Iron Lady","genre":"drama"}
{"name":"Matt Damon","title":"The Martian","genre":"drama"}
{"name":"Russell Crowe","title":"Gladiator","genre":"drama"}
Second, to consume those from fantasy films, run the following:
confluent kafka topic consume fantasy-acting-events --from-beginning --value-format avro
This should yield the following messages:
{"name":"Judy Garland","title":"The Wizard of Oz","genre":"fantasy"}
{"name":"Bill Murray","title":"Ghostbusters","genre":"fantasy"}
{"name":"Laura Dern","title":"Jurassic Park","genre":"fantasy"}
{"name":"Keanu Reeves","title":"The Matrix","genre":"fantasy"}
And finally, to consume all the other genres, run the following:
confluent kafka topic consume other-acting-events --from-beginning --value-format avro
This should yield the following messages:
{"name":"Will Smith","title":"Men in Black","genre":"comedy"}
{"name":"Jennifer Aniston","title":"Office Space","genre":"comedy"}
{"name":"Christian Bale","title":"The Dark Knight","genre":"crime"}
{"name":"Diane Keaton","title":"The Godfather: Part II","genre":"crime"}