verteiler

verteiler is a simple multi threaded blocking queue kafka consumer api

Лицензия

Лицензия

Категории

Категории

Данные
Группа

Группа

io.datanerds
Идентификатор

Идентификатор

verteiler
Последняя версия

Последняя версия

0.1.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

verteiler
verteiler is a simple multi threaded blocking queue kafka consumer api
Ссылка на сайт

Ссылка на сайт

http://datanerds.io
Система контроля версий

Система контроля версий

https://github.com/datanerds-io/verteiler

Скачать verteiler

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/io.datanerds/verteiler/ -->
<dependency>
    <groupId>io.datanerds</groupId>
    <artifactId>verteiler</artifactId>
    <version>0.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.datanerds/verteiler/
implementation 'io.datanerds:verteiler:0.1.0'
// https://jarcasting.com/artifacts/io.datanerds/verteiler/
implementation ("io.datanerds:verteiler:0.1.0")
'io.datanerds:verteiler:jar:0.1.0'
<dependency org="io.datanerds" name="verteiler" rev="0.1.0">
  <artifact name="verteiler" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.datanerds', module='verteiler', version='0.1.0')
)
libraryDependencies += "io.datanerds" % "verteiler" % "0.1.0"
[io.datanerds/verteiler "0.1.0"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
org.slf4j : slf4j-api jar 1.7.21
org.apache.kafka : kafka-clients jar 0.10.2.1
com.google.guava : guava jar 18.0

test (6)

Идентификатор библиотеки Тип Версия
org.hamcrest : hamcrest-all jar 1.3
org.mockito : mockito-all jar 1.10.19
org.slf4j : slf4j-simple jar 1.7.21
org.awaitility : awaitility jar 2.0.0
com.google.guava : guava-testlib jar 18.0
junit : junit jar 4.12

Модули Проекта

Данный проект не имеет модулей.

Build Status

Maven Central

Verteiler (fɛɐˈtailɐ)

"Verteiler" is german and translates to distributor. When you are using the (new) kafka-clients consumer introduced with v0.9.0, you will face the issue that Consumer.poll(...) can only be called from one thread. Verteiler leverages the kafka-client consumer implementation to distribute messages from assigned partitions to BlockingQueues. Each assigned partition will relay its messages to its own internal queue. These queues have worker threads which process the message leveraging a user defined consumer. Once a message has been processed successfully its offset will be committed asynchronously after poll(...) has finished. This way only the offset of processed messages is committed.

How to use verteiler

BlockingQueueConsumer

Parameters

String topic: Name of the topic you want to consume messages from.

Properties kafkaConfig: Regular consumer config. By default verteiler will disable auto offset commit and set a client id when not given.

int queueSize: Size of the internal queue, which depends on your needs.

java.util.function.Consumer<V> action: The function which will handle a message.

Example

Simple message counter:

Properties props = new Properties();
props.setProperty(BOOTSTRAP_SERVERS_CONFIG, "127.0.0.1:9092");
...
AtomicInteger messageCounter = new AtomicInteger();
Consumer<String> action = (message) -> messageCounter.incrementAndGet();

BlockingQueueConsumer<String, String> consumer = new BlockingQueueConsumer<>("my_topic", props, 42, action);
consumer.start();

For a full example take a look at BlockingQueueConsumerTest.

Build

gradle build will build the project. The integration tests will start embedded zookeeper & kafka instances.

io.datanerds

Версии библиотеки

Версия
0.1.0