This repository contains a Spring Boot application that acts as a Kafka producer. It demonstrates how to send messages to a Kafka topic using Apache Kafka and Spring Boot. The application runs on port 9191.
Before running the Kafka producer application, you need to set up a Kafka cluster locally. Follow the steps below to start a Kafka cluster on a Windows setup:
- 
Download and Extract Kafka: - Download the latest version of Apache Kafka from the official website: https://kafka.apache.org/downloads
- Extract the downloaded archive to a directory of your choice.
 
- 
Start ZooKeeper: - 
Open a command prompt and navigate to the Kafka directory. 
- 
Run the following command to start ZooKeeper: bin\windows\zookeeper-server-start.bat config\zookeeper.properties 
 
- 
- 
Start Kafka Broker: - 
In a new command prompt window, navigate to the Kafka directory. 
- 
Run the following command to start the Kafka broker: bin\windows\kafka-server-start.bat config\server.properties 
 
- 
- 
Create a Kafka Topic: - 
Open another command prompt window and navigate to the Kafka directory. 
- 
Run the following command to create a topic named "test-topic": bin\windows\kafka-topics.bat --create --topic test-topic --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1 
 You now have a Kafka cluster running locally with a topic named "test-topic." 
- 
Follow these steps to set up and run the Kafka producer application:
- 
Clone the Repository: Clone this repository to your local machine using the following command: git clone https://github.com/Ninjavin/Apache-Kafka-Producer.git 
- 
Configure Kafka Properties: - Open the src/main/resources/application.ymlfile.
- Update the spring.kafka.bootstrap-serversproperty to match your Kafka broker's address (e.g.,localhost:9092).
 
- Open the 
- 
Build and Run the Application 
- 
Send Messages: - Once the application is running, open Postman and send messages using the URL http://localhost:9191/producer-app/publish/{message}to send messages.
 
- Once the application is running, open Postman and send messages using the URL