{"id":36708400,"url":"https://github.com/streamthoughts/kafka-clients-kotlin","last_synced_at":"2026-01-12T11:45:09.469Z","repository":{"id":42047455,"uuid":"283536033","full_name":"streamthoughts/kafka-clients-kotlin","owner":"streamthoughts","description":"This projects gives Kotlin bindings and several extensions for Apache Kafka Clients.","archived":false,"fork":false,"pushed_at":"2022-04-15T16:30:41.000Z","size":162,"stargazers_count":41,"open_issues_count":1,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-05T04:15:06.295Z","etag":null,"topics":["apache-kafka","kafka-clients","kafka-consumer","kafka-producer","kotlin","kotlin-library"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/streamthoughts.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-29T15:30:24.000Z","updated_at":"2025-05-14T09:19:27.000Z","dependencies_parsed_at":"2022-08-12T03:20:40.081Z","dependency_job_id":null,"html_url":"https://github.com/streamthoughts/kafka-clients-kotlin","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/streamthoughts/kafka-clients-kotlin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamthoughts%2Fkafka-clients-kotlin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamthoughts%2Fkafka-clients-kotlin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamthoughts%2Fkafka-clients-kotlin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamthoughts%2Fkafka-clients-kotlin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/streamthoughts","download_url":"https://codeload.github.com/streamthoughts/kafka-clients-kotlin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamthoughts%2Fkafka-clients-kotlin/sbom","scorecard":{"id":855082,"data":{"date":"2025-08-11","repo":{"name":"github.com/streamthoughts/kafka-clients-kotlin","commit":"14c52f0994d8a3563d331ae55cec2bca08e323c2"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.2,"checks":[{"name":"Code-Review","score":0,"reason":"Found 1/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/maven.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/maven.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/streamthoughts/kafka-clients-kotlin/maven.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/maven.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/streamthoughts/kafka-clients-kotlin/maven.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 1 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"29 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-vmq6-5m68-f53m","Warn: Project is vulnerable to: GHSA-668q-qrv7-99fm","Warn: Project is vulnerable to: GHSA-6v67-2wr5-gvf4","Warn: Project is vulnerable to: GHSA-pr98-23f8-jwxv","Warn: Project is vulnerable to: GHSA-2x2g-32r7-p4x8","Warn: Project is vulnerable to: GHSA-3j6g-hxx5-3q26","Warn: Project is vulnerable to: GHSA-2qp4-g3q3-f92w","Warn: Project is vulnerable to: GHSA-cqj8-47ch-rvvq","Warn: Project is vulnerable to: GHSA-55g7-9cwv-5qfv","Warn: Project is vulnerable to: GHSA-fjpj-2g6w-x25r","Warn: Project is vulnerable to: GHSA-pqr6-cmr2-h8hf","Warn: Project is vulnerable to: GHSA-qcwq-55hx-v3vh","Warn: Project is vulnerable to: GHSA-h46c-h94j-95f3","Warn: Project is vulnerable to: GHSA-wf8f-6423-gfxg","Warn: Project is vulnerable to: GHSA-288c-cq4h-88gq","Warn: Project is vulnerable to: GHSA-3x8x-79m2-3w2w","Warn: Project is vulnerable to: GHSA-57j2-w4cx-62h2","Warn: Project is vulnerable to: GHSA-jjjh-jjxp-wpff","Warn: Project is vulnerable to: GHSA-rgv9-q543-rqg4","Warn: Project is vulnerable to: GHSA-5mg8-w23w-74h3","Warn: Project is vulnerable to: GHSA-7g45-4rm6-3mm3","Warn: Project is vulnerable to: GHSA-9vjp-v76f-g363","Warn: Project is vulnerable to: GHSA-grg4-wf29-r9vv","Warn: Project is vulnerable to: GHSA-389x-839f-4rhx","Warn: Project is vulnerable to: GHSA-xq3w-v528-46rv","Warn: Project is vulnerable to: GHSA-6mjq-h674-j845","Warn: Project is vulnerable to: GHSA-p7c9-8xx8-h74f","Warn: Project is vulnerable to: GHSA-7286-pgfv-vxvh","Warn: Project is vulnerable to: GHSA-8qv5-68g4-248j"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T23:41:41.169Z","repository_id":42047455,"created_at":"2025-08-23T23:41:41.169Z","updated_at":"2025-08-23T23:41:41.169Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338972,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T10:58:46.209Z","status":"ssl_error","status_checked_at":"2026-01-12T10:58:42.742Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["apache-kafka","kafka-clients","kafka-consumer","kafka-producer","kotlin","kotlin-library"],"created_at":"2026-01-12T11:45:09.370Z","updated_at":"2026-01-12T11:45:09.442Z","avatar_url":"https://github.com/streamthoughts.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"= Kafka Clients for Kotlin\n:toc:\n:toc-placement!:\n\nimage:https://img.shields.io/badge/License-Apache%202.0-blue.svg[https://github.com/streamthoughts/kafka-clients-kotlin/blob/master/LICENSE]\nimage:https://img.shields.io/github/v/release/streamthoughts/kafka-clients-kotlin[GitHub release (latest by date)]\nimage:https://img.shields.io/github/issues-raw/streamthoughts/kafka-clients-kotlin[GitHub issues]\nimage:https://img.shields.io/github/workflow/status/streamthoughts/kafka-clients-kotlin/Java%20CI%20with%20Maven[GitHub Workflow Status]\nimage:https://img.shields.io/github/stars/streamthoughts/kafka-clients-kotlin?style=social[GitHub Repo stars]\n\nWARNING: Be aware that this package is still in heavy development. Some breaking change will occur in future weeks and months.\nThank's for your comprehension.\n\ntoc::[]\n\n== What is Kafka Clients for Kotlin ?\n\nThe **Kafka Clients for Kotlin** projects packs with convenient Kotlin API for the development of Kafka-based event-driven applications.\nIt provides high-level abstractions both for sending records `ProducerContainer` and consuming records from topics using one or many\nconcurrent consumers `KafkaConsumerWorker`.\n\nIn addition, it provides builder classes to facilitate the configuration of `Producer` and `Consumer` objects: `KafkaProducerConfigs` and `KafkaConsumerConfigs`\n\n**Kafka Clients for Kotlin** is based on the pure java `kafka-clients`.\n\n== How to contribute ?\n\nThe project is in its early stages so it can be very easy to contribute by proposing APIs changes, new features and so on. \nAny feedback, bug reports and PRs are greatly appreciated!\n\n* Source Code: https://github.com/streamthoughts/kafka-clients-kotlin\n* Issue Tracker: https://github.com/streamthoughts/kafka-clients-kotlin/issues\n\n\n== Show your support\n\nYou think this project can help you or your team to develop kafka-based application with Kotlin ?\nPlease ⭐ this repository to support us!\n\n== How to give it a try ?\n\nJust add **Kafka Clients for Kotlin** to the dependencies of your projects.\n\n=== For Maven\n[source,xml]\n----\n\u003cdependency\u003e\n  \u003cgroupId\u003eio.streamthoughts\u003c/groupId\u003e\n  \u003cartifactId\u003ekafka-clients-kotlin\u003c/artifactId\u003e\n  \u003cversion\u003e0.2.0\u003c/version\u003e\n\u003c/dependency\u003e\n----\n\n== Getting Started\n\n=== Writing messages to Kafka\n\n**Example: How to create `KafkaProducer` config ?**\n\n[source,kotlin]\n----\nval configs = producerConfigsOf()\n    .client { bootstrapServers(\"localhost:9092\") }\n    .acks(Acks.Leader)\n    .keySerializer(StringSerializer::class.java.name)\n    .valueSerializer(StringSerializer::class.java.name)\n----\n\n==== Example with standard `KafkaProducer` (i.e : using java `kafka-clients`)\n\n[source,kotlin]\n----\nval producer = KafkaProducer\u003cString, String\u003e(configs)\n\nval messages = listOf(\"I ❤️ Logs\", \"Making Sense of Stream Processing\", \"Apache Kafka\")\nproducer.use {\n    messages.forEach {value -\u003e\n        val record = ProducerRecord\u003cString, String\u003e(topic, value)\n        producer.send(record) { m: RecordMetadata, e: Exception? -\u003e\n            when (e) {\n                null -\u003e println(\"Record was successfully sent (topic=${m.topic()}, partition=${m.partition()}, offset= ${m.offset()})\")\n                else -\u003e e.printStackTrace()\n            }\n        }\n    }\n}\n----\n\nN.B: See the full source code: https://github.com/streamthoughts/kafka-clients-kotlin/blob/master/examples/src/main/kotlin/io/streamthoughts/kafka/client/examples/ProducerClientExample.kt[ProducerClientExample.kt]\n\n==== Example with Kotlin DSL\n\n[source,kotlin]\n----\nval producer: ProducerContainer\u003cString, String\u003e = kafka(\"localhost:9092\") {\n    client {\n        clientId(\"my-client\")\n    }\n\n    producer {\n        configure {\n            acks(Acks.InSyncReplicas)\n        }\n        keySerializer(StringSerializer())\n        valueSerializer(StringSerializer())\n\n        defaultTopic(\"demo-topic\")\n\n        onSendError {_, _, error -\u003e\n            error.printStackTrace()\n        }\n\n        onSendSuccess{ _, _, metadata -\u003e\n            println(\"Record was sent successfully: topic=${metadata.topic()}, partition=${metadata.partition()}, offset=${metadata.offset()} \")\n        }\n    }\n}\n\nval messages = listOf(\"I ❤️ Logs\", \"Making Sense of Stream Processing\", \"Apache Kafka\")\nproducer.use {\n    producer.init() // create internal producer and call initTransaction() if `transactional.id` is set\n    messages.forEach { producer.send(value = it) }\n}\n----\n\nN.B: See the full source code: https://github.com/streamthoughts/kafka-clients-kotlin/blob/master/examples/src/main/kotlin/io/streamthoughts/kafka/client/examples/ProducerKotlinDSLExample.kt[ProducerKotlinDSLExample.kt]\n\n=== Consuming messages from a Kafka topic\n\n==== Example: How to create `KafkaConsumer` config ?\n\n[source,kotlin]\n----\nval configs = consumerConfigsOf()\n    .client { bootstrapServers(\"localhost:9092\") }\n    .groupId(\"demo-consumer-group\")\n    .keyDeserializer(StringDeserializer::class.java.name)\n    .valueDeserializer(StringDeserializer::class.java.name)\n----\n\n==== Example with standard `KafkaConsumer` (i.e : using java `kafka-clients`)\n\n[source,kotlin]\n----\nval consumer = KafkaConsumer\u003cString, String\u003e(configs)\n\nconsumer.use {\n    consumer.subscribe(listOf(topic))\n    while(true) {\n        consumer\n            .poll(Duration.ofMillis(500))\n            .forEach { record -\u003e\n                println(\n                    \"Received record with key ${record.key()} \" +\n                    \"and value ${record.value()} from topic ${record.topic()} and partition ${record.partition()}\"\n                )\n            }\n    }\n}\n----\n\nN.B: See the full source code: https://github.com/streamthoughts/kafka-clients-kotlin/blob/master/examples/src/main/kotlin/io/streamthoughts/kafka/client/examples/ConsumerClientExample.kt[ConsumerClientExample.kt]\n\n==== Example with Kotlin DSL\n[source,kotlin]\n----\nval consumerWorker: ConsumerWorker\u003cString, String\u003e = kafka(\"localhost:9092\") {\n    client {\n        clientId(\"my-client\")\n    }\n\n    val stringDeserializer: Deserializer\u003cString\u003e = StringDeserializer()\n    consumer(\"my-group\", stringDeserializer, stringDeserializer) {\n        configure {\n            maxPollRecords(1000)\n            autoOffsetReset(AutoOffsetReset.Earliest)\n        }\n\n        onDeserializationError(replaceWithNullOnInvalidRecord())\n\n        onPartitionsAssigned { _: Consumer\u003c*, *\u003e, partitions -\u003e\n            println(\"Partitions assigned: $partitions\")\n        }\n\n        onPartitionsRevokedAfterCommit { _: Consumer\u003c*, *\u003e, partitions -\u003e\n            println(\"Partitions revoked: $partitions\")\n        }\n\n        onConsumed { _: Consumer\u003c*, *\u003e, value: String? -\u003e\n            println(\"consumed record-value: $value\")\n        }\n\n        onConsumedError(closeTaskOnConsumedError())\n\n        Runtime.getRuntime().addShutdownHook(Thread { run { stop() } })\n    }\n}\n\nconsumerWorker.use {\n    consumerWorker.start(\"demo-topic\", maxParallelHint = 4)\n    runBlocking {\n        println(\"All consumers started, waiting one minute before stopping\")\n        delay(Duration.ofMinutes(1).toMillis())\n    }\n}\n----\n\nN.B: See the full source code: https://github.com/streamthoughts/kafka-clients-kotlin/blob/master/examples/src/main/kotlin/io/streamthoughts/kafka/client/examples/ConsumerKotlinDSLExample.kt[ConsumerKotlinDSLExample.kt]\n\n== All Examples:\n\n* https://github.com/streamthoughts/kafka-clients-kotlin/blob/master/examples/src/main/kotlin/io/streamthoughts/kafka/client/examples/ProducerClientExample.kt[ProducerClientExample.kt]\n* https://github.com/streamthoughts/kafka-clients-kotlin/blob/master/examples/src/main/kotlin/io/streamthoughts/kafka/client/examples/ProducerKotlinDSLExample.kt[ProducerKotlinDSLExample.kt]\n* https://github.com/streamthoughts/kafka-clients-kotlin/blob/master/examples/src/main/kotlin/io/streamthoughts/kafka/client/examples/TxProducerContainerExample.kt[TxProducerContainerExample.kt]\n* https://github.com/streamthoughts/kafka-clients-kotlin/blob/master/examples/src/main/kotlin/io/streamthoughts/kafka/client/examples/ConsumerClientExample.kt[ConsumerClientExample.kt]\n* https://github.com/streamthoughts/kafka-clients-kotlin/blob/master/examples/src/main/kotlin/io/streamthoughts/kafka/client/examples/ConsumerKotlinDSLExample.kt[ConsumerKotlinDSLExample.kt]\n\n== How to build project ?\n\nKafka Clients for Kotlin uses https://github.com/takari/maven-wrapper[maven-wrapper].\n\n[source,bash]\n----\n$ ./mvnw clean package\n----\n\nRun Tests\n\n[source,bash]\n----\n$ ./mvnw clean test\n----\n\n== Licence\n\nCopyright 2020 StreamThoughts.\n\nLicensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0[\"http://www.apache.org/licenses/LICENSE-2.0\"]\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamthoughts%2Fkafka-clients-kotlin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstreamthoughts%2Fkafka-clients-kotlin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamthoughts%2Fkafka-clients-kotlin/lists"}