Hi Gitesh. Sorry for the delayed response. You can send message asynchronously using the send() method:

producer.send(new ProducerRecord<>(topic, payload));

If you want to send messages synchronously, you can call the .get() method on the .send() method:

producer.send(new ProducerRecord<>(topic, payload)).get();

Coding, machine learning, reading, sleeping, listening, potato. https://blog.contactsunny.com and https://www.linkedin.com/in/sunnysrinidhi/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store