Develop consumers and producers in Java

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

Start the producer and consumer Java applications

Open a terminal and change into the apps/song-app/quarkus/song-app directory of the repository you cloned. Start the producer application in development mode:

$ cd /apps/song-app/quarkus/song-app

$ BOOTSTRAP_SERVER=$BOOTSTRAP_SERVER \
CLIENT_ID=$CLIENT_ID \
CLIENT_SECRET=$CLIENT_SECRET ./mvnw quarkus:dev

Open a second terminal and change directory into the apps/song-indexer-app/quarkus/song-indexer-app directory of the repository you just cloned, and start the consumer application:

$ cd /apps/song-indexer-app/quarkus/song-indexer-app

$ BOOTSTRAP_SERVER=$BOOTSTRAP_SERVER \
CLIENT_ID=$CLIENT_ID \
CLIENT_SECRET=$CLIENT_SECRET \
QUARKUS_HTTP_PORT=9090 ./mvnw quarkus:dev

The song-app service exposes a HTTP API on port 8080, and can be used to produce songs into the songs-catalog topic. The song-indexer-app is listening on port 8080, and exposes a HTTP endpoint that will stream messages it consumes from the songs-catalog topic to a HTTP client.

Previous resource
Clone the Git repository
Next resource
Produce and consume songs