Kafka Producer Examples Using Java: Apache Kafka is an open-source stream-processing software platform developed by LinkedIn and donated to the Apache Software Foundation, written in Scala and Java.

In this tutorial, we will see how to create Kafka producer examples using Java

  • Create a Simple Maven Project
  • Add below dependency to your POM

  • Create the Class with name SimpleProducer
  • Below is the code for creating the Producer in Kafka

Note :

  • Change the Topic name which already exists in your Kafka servers 
  • Change the Kafka Server Server IP address 

After running the SimplePrducer class as java application to insert record to your Kafka server

after running you can see the records using tool http://www.kafkatool.com/download.html

Download the tool and connect to the Kafka server and open the topic name and partition to see the inserted records like below

If you didn’t find any records Use the Play button to refresh the data

Kafka-Producer-Java-Example

Thank You

Also Read: Kafka Consumer Examples Using Java

Kafka Producer Examples Using Java

Leave a Reply

Your email address will not be published. Required fields are marked *