Skip to content

MayankShivhare999/kafka-producer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kafka Producer

This is a simple Kafka Producer application built with Spring Boot.

Prerequisites

  • Java 17
  • Apache Kafka
  • Maven
  • Docker

Getting Started

  • Setup Kafka using Docker: Create a docker-compose.yml file in the root directory of your project with the following content:

    version: '3.8'
    services:
      zookeeper:
        image: confluentinc/cp-zookeeper:7.4.1
        container_name: zookeeper
        environment:
          ZOOKEEPER_CLIENT_PORT: 2181
          ZOOKEEPER_TICK_TIME: 2000
        ports:
          - "2181:2181"
    
      kafka:
        image: confluentinc/cp-kafka:7.4.1
        container_name: kafka
        ports:
          - "9092:9092"
        environment:
          KAFKA_BROKER_ID: 1
          KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
          KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
          KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
        depends_on:
          - zookeeper

    Then, run the following command to start Kafka and Zookeeper:

    docker-compose up -d

Installation

  1. Clone the producer repository:
git clone https://github.com/MayankShivhare999/kafka-producer.git
  1. Navigate to the project directory:
cd kafka-producer
  1. Build the project:
mvn clean install
  1. To run the producer application, use the following command:
mvn spring-boot:run
  1. Clone the consumer repository:
git clone https://github.com/MayankShivhare999/kafka-consumer.git
  1. Navigate to the project directory:
cd kafka-consumer
  1. Build the project:
mvn clean install
  1. To run the consumer application, use the following command:
mvn spring-boot:run

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages