Skip to content

Commit 7c66877

Browse files
nomisRevgithub-actions[bot]
authored andcommitted
Auto update docs
1 parent c8186c1 commit 7c66877

File tree

115 files changed

+4817
-162
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+4817
-162
lines changed

docs/index.html

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,25 @@
4646
<div class="breadcrumbs"></div>
4747
<div class="cover ">
4848
<h1 class="cover"><span><span>kotlin-kafka</span></span></h1>
49-
<div class="platform-hinted UnderCoverText" data-platform-hinted="data-platform-hinted"><div class="content sourceset-depenent-content" data-active="" data-togglable=":dokkaHtml/main"><p class="paragraph"><a href="https://maven-badges.herokuapp.com/maven-central/io.github.nomisrev/kotlin-kafka"></a></p><!--- TEST_NAME ReadmeTest --><!--- TOC --><ul><li><p class="paragraph">#rationale</p></li><li><p class="paragraph">#goals</p></li><li><p class="paragraph">#adding-dependency</p></li><li><p class="paragraph">#example</p></li></ul><!--- END --><p class="paragraph">This project is still under development, andd started as a playground where I was playing around with Kafka in Kotlin and the Kafka SDK whilst reading the Kafka book Definite Guide from Confluent. https://www.confluent.io/resources/kafka-the-definitive-guide-v2/</p><h2 class=""> Rationale</h2><p class="paragraph">At the time of starting this repository I didn't find any bindings between Kafka SDK and Kotlin suspension. These operators should be implemented low-level, so they can guarantee correct cancellation support, and high optimised runtimes.</p><h2 class=""> Goals</h2><ul><li><p class="paragraph">Lean Core library built on top of Kotlin Std & KotlinX Coroutines (possible extensions with Arrow in additional module)</p></li><li><p class="paragraph">Extensions to easily operate over the Kafka SDK with KotlinX Coroutines and <code class="lang-kotlin">suspend</code>.</p></li><li><p class="paragraph">Flow based operators, so you can easily compose KotlinX Flow based Kafka programs</p></li><li><p class="paragraph">example for testing Kafka with Test Containers in Kotlin.</p></li></ul><h2 class=""> Adding Dependency</h2><p class="paragraph">Simply add the following dependency as <code class="lang-kotlin">implementation</code> in the <code class="lang-kotlin">build.gradle</code> dependencies` block.</p><div class="sample-container"><pre><code class="block lang-groovy" theme="idea">dependencies {<br> implementation(&quot;io.github.nomisrev:kotlin-kafka:0.2.0&quot;)<br>}</code></pre><span class="top-right-position"><span class="copy-icon"></span><div class="copy-popup-wrapper popup-to-left"><span class="copy-popup-icon"></span><span>Content copied to clipboard</span></div></span></div><h2 class=""> Example</h2><!--- INCLUDE
50-
import java.util.UUID
51-
import kotlinx.coroutines.Dispatchers.Default
49+
<div class="platform-hinted UnderCoverText" data-platform-hinted="data-platform-hinted"><div class="content sourceset-depenent-content" data-active="" data-togglable=":dokkaHtml/main"><p class="paragraph"><a href="https://maven-badges.herokuapp.com/maven-central/io.github.nomisrev/kotlin-kafka"></a></p><!--- TOC --><ul><li><p class="paragraph">#rationale</p></li><li><p class="paragraph">#goals</p></li><li><p class="paragraph">#adding-dependency</p></li><li><p class="paragraph">#example</p></li></ul><!--- END --><h2 class=""> Rationale</h2><p class="paragraph">At the time of starting this repository I didn't find any bindings between Kafka SDK and Kotlin suspension, or KotlinX Coroutines Flow. These operators should be implemented low-level, so they can guarantee correct cancellation support, and high optimised runtimes.</p><p class="paragraph">Some important aspects of Kafka are tricky to implement with the &quot;low-level&quot; Kafka API, especially properly streaming records from Kafka and correctly committing them. Additional complexity is involved in this process, more details <a href="https://tuleism.github.io/blog/2021/parallel-backpressured-kafka-consumer/">here</a>.</p><p class="paragraph">To solve these problems a couple of projects in the JVM already exist:</p><ul><li><p class="paragraph"><a href="https://github.com/akka/alpakka-kafka">Alpakka Kafka</a></p></li><li><p class="paragraph"><a href="https://github.com/reactor/reactor-kafka">reactor-kafka</a></p></li></ul><p class="paragraph">There was no implementation for KotlinX Coroutines Flow, you can however quite easily use reactor-kafka with <a href="https://github.com/Kotlin/kotlinx.coroutines/blob/master/reactive/kotlinx-coroutines-reactor/README.md">KotlinX Coroutines Reactor bindings</a>.</p><p class="paragraph">This project implements the same strategies as reactor-kafka directly on top of KotlinX Coroutines to benefit from <strong>all</strong> their benefits, and to open the door to potentially becoming a Kotlin MPP library in the future.</p><h2 class=""> Goals</h2><ul><li><p class="paragraph">Lean Core library built on top of Kotlin Std & KotlinX Coroutines</p></li><li><p class="paragraph">Extensions to easily operate over the Kafka SDK with KotlinX Coroutines and <code class="lang-kotlin">suspend</code>.</p></li><li><p class="paragraph">Flow based operators, so you can easily compose KotlinX Flow based Kafka programs</p></li><li><p class="paragraph">Strong guarantees about committing record offsets, and performance optimisations in regard to re-balancing/partitioning.</p></li><li><p class="paragraph">example for testing Kafka with Test Containers in Kotlin.</p></li></ul><h2 class=""> Adding Dependency</h2><p class="paragraph">Simply add the following dependency as <code class="lang-kotlin">implementation</code> in the <code class="lang-kotlin">build.gradle</code> dependencies` block.</p><div class="sample-container"><pre><code class="block lang-groovy" theme="idea">dependencies {<br> implementation(&quot;io.github.nomisrev:kotlin-kafka:0.2.0&quot;)<br>}</code></pre><span class="top-right-position"><span class="copy-icon"></span><div class="copy-popup-wrapper popup-to-left"><span class="copy-popup-icon"></span><span>Content copied to clipboard</span></div></span></div><h2 class=""> Example</h2><!--- INCLUDE
50+
import io.github.nomisRev.kafka.receiver.KafkaReceiver
51+
import io.github.nomisRev.kafka.receiver.ReceiverSettings
52+
import kotlinx.coroutines.Dispatchers
5253
import kotlinx.coroutines.coroutineScope
54+
import kotlinx.coroutines.delay
55+
import kotlinx.coroutines.flow.Flow
5356
import kotlinx.coroutines.flow.asFlow
54-
import kotlinx.coroutines.flow.collect
5557
import kotlinx.coroutines.flow.map
5658
import kotlinx.coroutines.flow.take
5759
import kotlinx.coroutines.launch
60+
import kotlinx.coroutines.runBlocking
5861
import org.apache.kafka.clients.admin.NewTopic
5962
import org.apache.kafka.clients.producer.ProducerRecord
6063
import org.apache.kafka.common.serialization.IntegerDeserializer
6164
import org.apache.kafka.common.serialization.IntegerSerializer
6265
import org.apache.kafka.common.serialization.StringDeserializer
6366
import org.apache.kafka.common.serialization.StringSerializer
67+
import java.util.UUID
6468
--><div class="sample-container"><pre><code class="block lang-kotlin" theme="idea"></code></pre><span class="top-right-position"><span class="copy-icon"></span><div class="copy-popup-wrapper popup-to-left"><span class="copy-popup-icon"></span><span>Content copied to clipboard</span></div></span></div><div class="block"></div></div></div>
6569
</div>
6670
<h2 class="">Packages</h2>
@@ -78,6 +82,20 @@ <h2 class="">Packages</h2>
7882
<div></div>
7983
</div>
8084
</div>
85+
<a data-name="-749937321%2FPackages%2F769193423" anchor-label="io.github.nomisRev.kafka.receiver" id="-749937321%2FPackages%2F769193423" data-filterable-set=":dokkaHtml/main"></a>
86+
<div class="table-row" data-filterable-current=":dokkaHtml/main" data-filterable-set=":dokkaHtml/main">
87+
<div>
88+
<div class="main-subrow ">
89+
<div class=""><span class="inline-flex">
90+
<div><a href="kotlin-kafka/io.github.nomisRev.kafka.receiver/index.html">io.github.nomisRev.kafka.receiver</a></div>
91+
<span class="anchor-wrapper"><span class="anchor-icon" pointing-to="-749937321%2FPackages%2F769193423"></span>
92+
<div class="copy-popup-wrapper "><span class="copy-popup-icon"></span><span>Link copied to clipboard</span></div>
93+
</span></span></div>
94+
<div class="pull-right"></div>
95+
</div>
96+
<div></div>
97+
</div>
98+
</div>
8199
</div>
82100
</div>
83101
<div class="footer">
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta name="viewport" content="width=device-width, initial-scale=1" charset="UTF-8">
5+
<title>BySizeOrTime</title>
6+
<link href="../../../../images/logo-icon.svg" rel="icon" type="image/svg">
7+
<script>var pathToRoot = "../../../../";</script>
8+
<script>const storage = localStorage.getItem("dokka-dark-mode")
9+
const savedDarkMode = storage ? JSON.parse(storage) : false
10+
if(savedDarkMode === true){
11+
document.getElementsByTagName("html")[0].classList.add("theme-dark")
12+
}</script>
13+
<script type="text/javascript" src="../../../../scripts/sourceset_dependencies.js" async="async"></script>
14+
<link href="../../../../styles/style.css" rel="Stylesheet">
15+
<link href="../../../../styles/jetbrains-mono.css" rel="Stylesheet">
16+
<link href="../../../../styles/main.css" rel="Stylesheet">
17+
<link href="../../../../styles/prism.css" rel="Stylesheet">
18+
<link href="../../../../styles/logo-styles.css" rel="Stylesheet">
19+
<script type="text/javascript" src="../../../../scripts/clipboard.js" async="async"></script>
20+
<script type="text/javascript" src="../../../../scripts/navigation-loader.js" async="async"></script>
21+
<script type="text/javascript" src="../../../../scripts/platform-content-handler.js" async="async"></script>
22+
<script type="text/javascript" src="../../../../scripts/main.js" defer="defer"></script>
23+
<script type="text/javascript" src="../../../../scripts/prism.js" async="async"></script>
24+
</head>
25+
<body>
26+
<div class="navigation-wrapper" id="navigation-wrapper">
27+
<div id="leftToggler"><span class="icon-toggler"></span></div>
28+
<div class="library-name">
29+
<a href="../../../../index.html">
30+
<span>kotlin-kafka</span>
31+
</a>
32+
</div>
33+
<div>
34+
0.2.2-SNAPSHOT </div>
35+
<div class="pull-right d-flex">
36+
<button id="theme-toggle-button"><span id="theme-toggle"></span></button>
37+
<div id="searchBar"></div>
38+
</div>
39+
</div>
40+
<div id="container">
41+
<div id="leftColumn">
42+
<div id="sideMenu"></div>
43+
</div>
44+
<div id="main">
45+
<div class="main-content" id="content" pageIds="kotlin-kafka::io.github.nomisRev.kafka.receiver/CommitStrategy.BySizeOrTime/BySizeOrTime/#kotlin.Int#kotlin.time.Duration/PointingToDeclaration//769193423">
46+
<div class="breadcrumbs"><a href="../../../../index.html">kotlin-kafka</a><span class="delimiter">/</span><a href="../../index.html">io.github.nomisRev.kafka.receiver</a><span class="delimiter">/</span><a href="../index.html">CommitStrategy</a><span class="delimiter">/</span><a href="index.html">BySizeOrTime</a><span class="delimiter">/</span><a href="-by-size-or-time.html">BySizeOrTime</a></div>
47+
<div class="cover ">
48+
<h1 class="cover"><span>By</span><wbr></wbr><span>Size</span><wbr></wbr><span>Or</span><wbr></wbr><span><span>Time</span></span></h1>
49+
</div>
50+
<div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-depenent-content" data-active="" data-togglable=":dokkaHtml/main"><div class="symbol monospace"><span class="token keyword"></span><span class="token keyword">fun </span><a href="-by-size-or-time.html"><span class="token function">BySizeOrTime</span></a><span class="token punctuation">(</span><span class="parameters "><span class="parameter ">size<span class="token operator">: </span><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a><span class="token punctuation">, </span></span><span class="parameter ">interval<span class="token operator">: </span><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.time/-duration/index.html">Duration</a></span></span><span class="token punctuation">)</span><span class="top-right-position"><span class="copy-icon"></span><div class="copy-popup-wrapper popup-to-left"><span class="copy-popup-icon"></span><span>Content copied to clipboard</span></div></span></div></div></div>
51+
<h2 class="">Sources</h2>
52+
<div class="table" data-togglable="Sources"><a data-name="-2135726207%2FSource%2F769193423" anchor-label="https://github.com/nomisRev/kotlin-kafka/tree/main/src/main/kotlin/io/github/nomisRev/kafka/receiver/CommitStrategy.kt#L39" id="-2135726207%2FSource%2F769193423" data-filterable-set=":dokkaHtml/main"></a>
53+
<div class="table-row" data-filterable-current=":dokkaHtml/main" data-filterable-set=":dokkaHtml/main">
54+
<div class="main-subrow keyValue ">
55+
<div class=""><span class="inline-flex">
56+
<div><a href="https://github.com/nomisRev/kotlin-kafka/tree/main/src/main/kotlin/io/github/nomisRev/kafka/receiver/CommitStrategy.kt#L39">jvm source</a></div>
57+
<span class="anchor-wrapper"><span class="anchor-icon" pointing-to="-2135726207%2FSource%2F769193423"></span>
58+
<div class="copy-popup-wrapper "><span class="copy-popup-icon"></span><span>Link copied to clipboard</span></div>
59+
</span></span></div>
60+
<div></div>
61+
</div>
62+
</div>
63+
</div>
64+
</div>
65+
<div class="footer">
66+
<span class="go-to-top-icon"><a href="#content" id="go-to-top-link"></a></span><span>© 2022 Copyright</span><span
67+
class="pull-right"><span>Generated by </span><a
68+
href="https://github.com/Kotlin/dokka"><span>dokka</span><span class="padded-icon"></span></a></span>
69+
</div>
70+
</div>
71+
</div>
72+
</body>
73+
</html>

0 commit comments

Comments
 (0)