GithubHelp home page GithubHelp logo

netkuz / java-kafka-connectivity Goto Github PK

View Code? Open in Web Editor NEW

This project forked from softwaremill/java-kafka-connectivity

0.0 0.0 0.0 89 KB

Showcase of possibilities connecting with Kafka using Java tools

License: Apache License 2.0

Java 100.00%

java-kafka-connectivity's Introduction

Java Kafka connectivity

Before running any application or Spring test producing sample messages, run docker-compose up to start a local Kafka deployment.

Then, create a partitioned topic, e.g.: ./kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 3 --topic some_topic

Plain Java

Run plain Kafka consumer by starting KafkaConsumerApp. Configuration is held by application.properties file.

Spring Boot

You can start it using BootApplication class. Various containers and message listeners have some parts of the code commented out, so only one type of listener can be started at once.

test package contains a sample test running a simple Kafka producer to feed required topic with some (partitioned) data.

Micronaut

The Micronaut version of Kafka consumer can be started by running MicronautApplicaiton class. As in Sppring Boot example, here you can find some code commented out as well.

Akka Streams

Implementation for Akka Streams contains three apps.

PlainRecordApp uses a plain source mechanism, consuming records one by one on the same thread.

PartitionedApp process messages in parallel, with a dedicated thread per partition.

CommittableApp provides an example of an application with manual commits.

Vert.x

Kafka vertices are implemented by vertx-kafka-client component.

Build project using goal from vertx-gradle-plugin: ./gradlew :vert-x:build

You can then start the application by calling java -jar vert-x-1.0-all.jar. It starts single-threaded Kafka consumer. You can run thread-per-partition consumer by providing -Dconsumer.type=multi parameter.

java-kafka-connectivity's People

Contributors

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