{"id":19243475,"url":"https://github.com/bootique/bootique-kafka","last_synced_at":"2025-04-21T09:33:09.373Z","repository":{"id":42421034,"uuid":"62172492","full_name":"bootique/bootique-kafka","owner":"bootique","description":"Provides integration of Kafka client and streams with Bootique","archived":false,"fork":false,"pushed_at":"2025-04-19T13:22:58.000Z","size":356,"stargazers_count":4,"open_issues_count":2,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-19T18:03:33.664Z","etag":null,"topics":["bootique","kafka","kafka-client"],"latest_commit_sha":null,"homepage":"http://bootique.io","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bootique.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-06-28T20:35:12.000Z","updated_at":"2025-04-19T13:23:02.000Z","dependencies_parsed_at":"2024-04-05T08:27:48.936Z","dependency_job_id":"50e50598-2c10-4347-b73d-62db01ccd506","html_url":"https://github.com/bootique/bootique-kafka","commit_stats":null,"previous_names":["bootique/bootique-kafka-client"],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bootique%2Fbootique-kafka","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bootique%2Fbootique-kafka/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bootique%2Fbootique-kafka/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bootique%2Fbootique-kafka/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bootique","download_url":"https://codeload.github.com/bootique/bootique-kafka/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250032343,"owners_count":21363820,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bootique","kafka","kafka-client"],"created_at":"2024-11-09T17:18:09.455Z","updated_at":"2025-04-21T09:33:04.359Z","avatar_url":"https://github.com/bootique.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\n  Licensed to ObjectStyle LLC under one\n  or more contributor license agreements.  See the NOTICE file\n  distributed with this work for additional information\n  regarding copyright ownership.  The ObjectStyle LLC licenses\n  this file to you under the Apache License, Version 2.0 (the\n  \"License\"); you may not use this file except in compliance\n  with the License.  You may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing,\n  software distributed under the License is distributed on an\n  \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n  KIND, either express or implied.  See the License for the\n  specific language governing permissions and limitations\n  under the License.\n  --\u003e\n\n[![build test deploy](https://github.com/bootique/bootique-kafka/actions/workflows/maven.yml/badge.svg)](https://github.com/bootique/bootique-kafka/actions/workflows/maven.yml)\n[![Maven Central](https://img.shields.io/maven-central/v/io.bootique.kafka/bootique-kafka-client.svg?colorB=brightgreen)](https://search.maven.org/artifact/io.bootique.kafka/bootique-kafka-client/)\n\n# bootique-kafka\n\n## Dependencies\n\nInclude the BOMs and then ```bootique-kafka-client```:\n```xml\n\u003cdependencyManagement\u003e\n    \u003cdependencies\u003e\n        \u003cdependency\u003e\n            \u003cgroupId\u003eio.bootique.bom\u003c/groupId\u003e\n            \u003cartifactId\u003ebootique-bom\u003c/artifactId\u003e\n            \u003cversion\u003e3.0-M4\u003c/version\u003e\n            \u003ctype\u003epom\u003c/type\u003e\n            \u003cscope\u003eimport\u003c/scope\u003e\n        \u003c/dependency\u003e\n    \u003c/dependencies\u003e\n\u003c/dependencyManagement\u003e\n...\n\n\u003c!-- If using Producer and/or Consumer --\u003e\n\u003cdependency\u003e\n\t\u003cgroupId\u003eio.bootique.kafka\u003c/groupId\u003e\n\t\u003cartifactId\u003ebootique-kafka-client\u003c/artifactId\u003e\n\u003c/dependency\u003e\n\n\u003c!-- If using streams --\u003e\n\u003cdependency\u003e\n\t\u003cgroupId\u003eio.bootique.kafka\u003c/groupId\u003e\n\t\u003cartifactId\u003ebootique-kafka-streams\u003c/artifactId\u003e\n\u003c/dependency\u003e\n```\n\n\n## Producer/Consumer Configuration\n\nConfigure parameters in the YAML. Note that practically all of these settings can be overridden when creating a\nspecific Producer or Consumer instance via `KafkaProducerFactory` or `KafkaConsumerFactory`. So this is just a\ncollection of defaults for the most typical Producer or Consumer:\n\n```yaml\nkafkaclient:\n  # any number of named clusters, specifying comma-separated bootstrap Kafka servers for each.\n  clusters:\n    cluster1: 127.0.0.1:9092\n    cluster2: host1:9092,host2:9092\n  consumer:\n    autoCommit: true\n    autoCommitInterval: \"200ms\"\n    defaultGroup: myappgroup\n    sessionTimeout: \"2s\"\n  producer:\n    acks: all # values are \"all\" or numeric number for min acks\n    retries: 1\n    batchSize: 16384\n    linger: \"1ms\"\n    bufferMemory: 33554432\n```\n\nNow you can inject producer and consumer factories and create any number of producers and consumers (for more details\nsee [bootique-kafka-examples](https://github.com/bootique-examples/bootique-kafka-examples)).\n\nProducer:\n```java\n@Inject\nKafkaProducerFactory factory;\n\npublic void runProducer() {\n\n    Producer\u003cbyte[], String\u003e producer = factory\n        .charValueProducer()\n        .cluster(\"cluster2\")\n        .create();\n\n    producer.send(new ProducerRecord\u003c\u003e(\"mytopic\", \"Hi!\"));\n\n    // close if there's nothing else to send\n    producer.close();\n}\n```\n\nConsumer example (also see [this code sample](https://github.com/bootique-examples/bootique-kafka-consumer)) :\n```java\n@Inject\nKafkaConsumerFactory factory;\n\n// a custom function to consume data \npublic void consumeBatch(Consumer\u003cK, V\u003e consumer, ConsumerRecords\u003cK, V\u003e data){\n    data.forEach(r -\u003e System.out.println(r.topic() + \"_\" + r.offset() + \": \" + r.value()))\n}\n\npublic void runConsumer() {\n    KafkaPollingTracker poll = factory\n        \n        // configure consumer\n        .charValueConsumer()\n        .cluster(\"cluster1\")\n        .group(\"somegroup\")\n        .topic(\"mytopic\")\n        \n        // start the consumer in the background\n        .consume(this::consumeBatch, Duration.ofSeconds(1));\n    \n    // Close when we need to stop consumption. With no explicit Bootique will\n    // close the consumer before the app exit\n    // poll.close();\n}\n```\n\n## Streams Configuration\n\nTODO\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbootique%2Fbootique-kafka","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbootique%2Fbootique-kafka","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbootique%2Fbootique-kafka/lists"}