bootique-kafka-parent: Integration of various versions of Kafka clients with Bootique

Provides integration of various versions of Kafka clients with Bootique

Лицензия

Лицензия

Категории

Категории

CLI Взаимодействие с пользователем Bootique Веб-фреймворки
Группа

Группа

io.bootique.kafka.client
Идентификатор

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

bootique-kafka-client-parent
Последняя версия

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

0.25
Дата

Дата

Тип

Тип

pom
Описание

Описание

bootique-kafka-parent: Integration of various versions of Kafka clients with Bootique
Provides integration of various versions of Kafka clients with Bootique
Организация-разработчик

Организация-разработчик

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

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

https://github.com/bootique/bootique-kafka-client

Скачать bootique-kafka-client-parent

Имя Файла Размер
bootique-kafka-client-parent-0.25.pom 3 KB
Обзор

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

<!-- https://jarcasting.com/artifacts/io.bootique.kafka.client/bootique-kafka-client-parent/ -->
<dependency>
    <groupId>io.bootique.kafka.client</groupId>
    <artifactId>bootique-kafka-client-parent</artifactId>
    <version>0.25</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/io.bootique.kafka.client/bootique-kafka-client-parent/
implementation 'io.bootique.kafka.client:bootique-kafka-client-parent:0.25'
// https://jarcasting.com/artifacts/io.bootique.kafka.client/bootique-kafka-client-parent/
implementation ("io.bootique.kafka.client:bootique-kafka-client-parent:0.25")
'io.bootique.kafka.client:bootique-kafka-client-parent:pom:0.25'
<dependency org="io.bootique.kafka.client" name="bootique-kafka-client-parent" rev="0.25">
  <artifact name="bootique-kafka-client-parent" type="pom" />
</dependency>
@Grapes(
@Grab(group='io.bootique.kafka.client', module='bootique-kafka-client-parent', version='0.25')
)
libraryDependencies += "io.bootique.kafka.client" % "bootique-kafka-client-parent" % "0.25"
[io.bootique.kafka.client/bootique-kafka-client-parent "0.25"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

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

  • bootique-kafka-client
  • bootique-kafka-client-0.8

Build Status Maven Central

bootique-kafka

Integration of Kafka client and Kafka streams for Bootique. See usage examples:

Dependencies

Include the BOMs and then bootique-kafka-client:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.bootique.bom</groupId>
            <artifactId>bootique-bom</artifactId>
            <version>2.0.M1</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>
...

<!-- If using Producer and/or Consumer -->
<dependency>
	<groupId>io.bootique.kafka</groupId>
	<artifactId>bootique-kafka-client</artifactId>
</dependency>

<!-- If using streams -->
<dependency>
	<groupId>io.bootique.kafka</groupId>
	<artifactId>bootique-kafka-streams</artifactId>
</dependency>

Producer/Consumer Configuration

Configure parameters in the YAML. Note that practically all of these settings can be overidden when obtaining a specific Producer or Consumer instance via io.bootique.kafka.client.KafkaClientFactory. So this is just a collection of defaults for the most typical Producer or Consumer:

kafkaclient:
  # any number of named clusters, specifying comma-separated bootstrap Kafka servers for each.
  clusters:
    cluster1: 127.0.0.1:9092
    cluster2: host1:9092,host2:9092
  consumer:
    autoCommit: true
    autoCommitInterval: "200ms"
    defaultGroup: myappgroup
    sessionTimeout: "2s"
  producer:
    acks: all # values are "all" or numeric number for min acks
    retries: 1
    batchSize: 16384
    linger: "1ms"
    bufferMemory: 33554432

Now you can inject producer and consumer factories and create any number of producers and consumers. Producer example (also see this code sample) :

@Inject
KafkaProducerFactory factory;

public void runProducer() {

    Producer<byte[], String> producer = factory
        .charValueProducer()
        .cluster("cluster2")
        .create();

    producer.send(new ProducerRecord<>("mytopic", "Hi!"));

    // close if there's nothing else to send
    producer.close();
}

Consumer example (also see this code sample) :

@Inject
KafkaConsumerFactory factory;

public void runConsumer() {
    
    KafkaConsumerRunner<byte[], String> consumer = factory
        .charValueConsumer()
        .cluster("cluster1")
        .group("somegroup")
        .topic("mytopic")
        .pollInterval(Duration.ofSeconds(1))
        .create();

    for (ConsumerRecord<byte[], String> r : consumer) {
        System.out.println(r.topic() + "_" + r.partition() + "_" + r.offset() + ": " + r.value());
    }

    consumer.close();
}

Streams Configuration

TODO

io.bootique.kafka.client

Bootique Project

Bootique is a minimally opinionated platform for modern runnable Java apps

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

Версия
0.25
0.24
0.5
0.4
0.3
0.2
0.1