Giter Club home page Giter Club logo

kafka-with-springboot's Introduction

Apache Kafka with Springboot

Apache Kafka is an open source distributed data streaming platform that can process, publish, store, and subscribe to streams of data in real time developed by LinkedIn and Apache. It can handle data streams from many sources and deliver them to many consumers.

Basic Idea for the Project

This is a Java Spring Boot application that demonstrates how to use Apache Kafka to produce and consume dummy location data. Many tech giants like Uber, Zomato etc. use Apache Kafka as a datahub for continuous location update of the cabs or delivery partner(in the case of food delivery companies) ans then pass it on to the end user.

Installation

  1. Prerequisites:

  2. Useful commands:

    • To Start the Zookeeper and Kafka server using following commands
      bin\windows\zookeeper-server-start.bat config\zookeeper.properties
      bin\windows\kafka-server-start.bat config\server.properties
    • To create Kafka topic named location-update-topic:
    bin\windows\kafka-topics.bat --create --topic location-update-topic --bootstrap-server localhost:9092
    • To start the Producer on this topic:
      bin\windows\kafka-console-producer.bat --topic location-update-topic --bootstrap-server localhost:9092
    • To start the Consumer on this topic:
      bin\windows\kafka-console-consumer.bat --topic location-update-topic --from-beginning --bootstrap-server localhost:9092
    • Or you can directly run the Spring Boot application to register the producer and consumer for the same topic.
  3. Producing and Consuming Data:

    • The producer endpoint (/update) generates and sends 200,000 sample location data entries to the Kafka topic location-data-topic.
    • The consumer consumes messages from the location-data-topic topic and logs them to the console.
    • You can simultaneously view this from console as well.

Project Structure

  • src/main/java/com/deliveryboy/service/: Contains the service class for producing location data.
  • src/main/java/com/deliveryboy/controller/: Contains the controller class for exposing the REST Endpoint.
  • src/main/java/com/deliveryboy/config/: Contains the Kafka configuration class.
  • src/main/resources/: Contains application properties and Kafka configuration. Similarly for Consumer ther are similar files

Configuration

Kafka configurations can be modified in src/main/resources/application.properties.

Usage

kafka-with-springboot's People

Contributors

prasad2531 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.