First, try creating a REST service using spring MVC while keeping kafa aside.
Once you can start the hello world REST service, then select "Kafka Docs". A.
Refer to the docs on how to create a kafka cluster, and run the default client and client software products to test your cluster.
Now write the main java program and create the kafka manufacturer using the Kafka client API . Refer to your documents. Make sure that messages sent through the main program reach the consumer.
Now add the contents of this main program to the recreation service so that messages sent to the request body are now transmitted to the kafka cluster and read by the consumer.
Hope this helps.
Deepak bansal
source share