Giter Club home page Giter Club logo

simple-kafka-java-example's Introduction

simple-kafka-java-example

Simple way to create topic, consumer and producer to Apache Kafka

It's not big deal, but... when someone have start Apache Kafka adventure - it's a great gate to start this adventure... Java gate...

In this project I use:

In my other repo You can find identical example for other language (Python).

What we find in this repo:

  1. how to prepare development environment (using docker),
  2. how to create topic from Java using Admin,
  3. how to create simple Apache Kafka producer,
  4. how to create simple Apache Kafka consumer,
  5. how to write test for these subjects.

And that's all... in other my branch You can find some real project...

Ad. 1) - How to prepare development env using Docker.

Docker is a great soft to use it in cases when we mast use Apache Kafka, but we don't have it... Then, we can run Apache Kafka locally in simple way. Just You must do:

a) Install docker on your machine

e.g Docker Desktop on:

b) Run script: docker-compose.yml from our source - simple-kafka-java-example/kafka_env/docker-compose.yml. Use command docker compose up -d from file localization.

What this script do:

  • get docker images from repository,
  • configure env in docker container,
  • additionally add our test topic.

What software we have:

  • Apache Kafka (of course) - our main goal - message broker,
  • Apache ZooKeeper - it's not necessary, but very useful open-source server to coordinate whole our Zoo names Apache Kafka ( I'm convinced that you use IT in the near future...),
  • AKHQ - this software will let you in simple way manage and view data inside your Apache Kafka.

IMPORTANT:

  • (!) In this project I use very basic, essential configuration.
  • (!) Whole project have configuration localized in class (close to subject). That approach it's not correct but allow better focus on subject problem.
  • (!) In general - it's not clean code... it's education code! (for education, sometime better is create dirty code...)

Ad. 2) - How to create topic from Java using Admin

  • simple example how to create topic with AdminClient object from kafka-clients lib: TopicsCreator.java

Ad. 3) How to create simple Apache Kafka producer,

  • TODO

Ad. 4) How to create simple Apache Kafka consumer,

  • TODO

Ad. 5 - How to write test for these subjects

simple-kafka-java-example's People

Contributors

dirtyread 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.