How to create a Kafka Producer in Java


We want to create a simplest possible producer code that sends ten dummy string messages to a Kafka topic.
This example is an excerpt from the Book Kafka Streams – Real-time Stream Processing
For a detailed explanation of the example and much more, you can get access to the Book using below link.


Creating Simple Kafka Producer

Sending a message record to Kafka is a four-step process as shown in Code Listing.


You can access fully function project in our GitHub folder.

Read More

Author : Prashant Pandey -



You will also like:


Scala named arguments

Learn about named arguments and default values in Scala functions with examples.

Learning Journal

First Class Functions

Function is a first-class citizen in functional programming. What does it mean?

Learning Journal

Pure Function benefits

Pure Functions are used heavily in functional programming. Learn Why?

Learning Journal

Free virtual machines

Get upto six free VMs in Google Cloud and learn Bigdata.

Learning Journal

Referential Transparency

Referential Transparency is an easy method to verify the purity of a function.

Learning Journal