Produce and consume songs

Open a new terminal and use curl to open a stream receiving server-sent events from the consumer application (song-indexer-app):

$ curl http://localhost:9090/events

Open another terminal and POST an event to the producer application (song-app) using curl. This command writes a song message to the Kafka songs-catalog topic:

$ curl -X POST \

-d '{"id":1000,"name":"Portals","author":"Alan Silvestri"}' \

-H 'content-type:application/json' \

http://localhost:8080/songs

To verify that the song has been processed, check terminal 2 (song-indexer-app) for the following log line:

Song {"author":"Alan Silvestri","id":1000,"name":"Portals","op":"ADD"} indexed

In terminal 3, you should see that an event has been printed by the HTTP client receiving the consumed messages from Kafka via server-sent events:

data: {"author":"Alan Silvestri","id":1000,"name":"Portals","op":"ADD"}

Congratulations! You have successfully run a Java-based producer and a Java-based consumer that exchange messages via your managed Kafka instance.