Develop consumers and producers in Java

Continue your Apache Kafka journey by developing consumers and producers in Java to stream data.

Clone the repository containing the Java code for the producer and consumer applications into your development environment:

git clone git@github.com:redhat-cloud-services-tmm/kafka-tutorial.git kafka-tutorial

Under the apps directory, this repository contains two Java applications: one that acts as a Kafka producer (song-app) and another that acts as a Kafka consumer (song-indexer-app). These applications use MicroProfile Reactive Messaging to abstract away the specifics of the Kafka client library using Channels and Emitters.

Explore the code and you will see the Kafka and channel configurations in the application.properties. The Java API for RESTful Web Services (JAX-RS) is used to expose REST APIs that allow HTTP clients to send requests that produce messages to Kafka and that stream consumed events back to the HTTP client. 

Previous resource
Create a topic
Next resource
Start the producer and consumer Java applications