|
56 | 56 |
|
57 | 57 | <div class="row links">
|
58 | 58 |
|
59 |
| - <a class="icon-link svg-link" href="https://www.javadoc.io/doc/com.banno/site_2.13/6.0.2/"><span class="api" title="API"><svg class="svg-icon" width="100%" height="100%" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;"> |
| 59 | + <a class="icon-link svg-link" href="https://www.javadoc.io/doc/com.banno/site_2.13/6.1.0/"><span class="api" title="API"><svg class="svg-icon" width="100%" height="100%" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;"> |
60 | 60 | <g class="svg-shape">
|
61 | 61 | <path d="M75,47.5c13.246,0 24,10.754 24,24c0,13.246 -10.754,24 -24,24c-13.246,0 -24,-10.754 -24,-24c0,-13.246 10.754,-24 24,-24Zm-50,-0c13.246,-0 24,10.754 24,24c0,13.246 -10.754,24 -24,24c-13.246,-0 -24,-10.754 -24,-24c0,-13.246 10.754,-24 24,-24Zm2.705,16.735l7.239,0l0.622,-4.904l-21.833,0l-0,4.904l7.589,0l0,22.067l6.383,0l-0,-22.067Zm58.076,7.265c-0,-8.757 -3.698,-14.166 -10.781,-14.166c-7.083,-0 -10.781,5.604 -10.781,14.166c0,8.757 3.698,14.166 10.781,14.166c7.083,0 10.781,-5.604 10.781,-14.166Zm-6.539,0c0,6.538 -1.128,9.496 -4.242,9.496c-2.997,0 -4.242,-2.88 -4.242,-9.496c-0,-6.616 1.206,-9.496 4.242,-9.496c3.036,-0 4.242,2.88 4.242,9.496Zm-29.242,-67c13.246,0 24,10.754 24,24c0,13.246 -10.754,24 -24,24c-13.246,0 -24,-10.754 -24,-24c0,-13.246 10.754,-24 24,-24Zm0.512,9.834c-7.122,-0 -12.609,5.098 -12.609,14.127c-0,9.263 5.215,14.205 12.532,14.205c4.164,0 7.083,-1.634 9.068,-3.658l-2.88,-3.697c-1.518,1.206 -3.153,2.413 -5.838,2.413c-3.697,-0 -6.266,-2.763 -6.266,-9.263c-0,-6.616 2.724,-9.379 6.149,-9.379c2.102,-0 3.892,0.778 5.371,1.984l3.113,-3.775c-2.257,-1.868 -4.748,-2.957 -8.64,-2.957Z"/>
|
62 | 62 | </g>
|
|
76 | 76 |
|
77 | 77 | <div class="row">
|
78 | 78 |
|
79 |
| - <a class="icon-link svg-link" href="https://www.javadoc.io/doc/com.banno/site_2.13/6.0.2/"><span class="api" title="API"><svg class="svg-icon" width="100%" height="100%" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;"> |
| 79 | + <a class="icon-link svg-link" href="https://www.javadoc.io/doc/com.banno/site_2.13/6.1.0/"><span class="api" title="API"><svg class="svg-icon" width="100%" height="100%" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;"> |
80 | 80 | <g class="svg-shape">
|
81 | 81 | <path d="M75,47.5c13.246,0 24,10.754 24,24c0,13.246 -10.754,24 -24,24c-13.246,0 -24,-10.754 -24,-24c0,-13.246 10.754,-24 24,-24Zm-50,-0c13.246,-0 24,10.754 24,24c0,13.246 -10.754,24 -24,24c-13.246,-0 -24,-10.754 -24,-24c0,-13.246 10.754,-24 24,-24Zm2.705,16.735l7.239,0l0.622,-4.904l-21.833,0l-0,4.904l7.589,0l0,22.067l6.383,0l-0,-22.067Zm58.076,7.265c-0,-8.757 -3.698,-14.166 -10.781,-14.166c-7.083,-0 -10.781,5.604 -10.781,14.166c0,8.757 3.698,14.166 10.781,14.166c7.083,0 10.781,-5.604 10.781,-14.166Zm-6.539,0c0,6.538 -1.128,9.496 -4.242,9.496c-2.997,0 -4.242,-2.88 -4.242,-9.496c-0,-6.616 1.206,-9.496 4.242,-9.496c3.036,-0 4.242,2.88 4.242,9.496Zm-29.242,-67c13.246,0 24,10.754 24,24c0,13.246 -10.754,24 -24,24c-13.246,0 -24,-10.754 -24,-24c0,-13.246 10.754,-24 24,-24Zm0.512,9.834c-7.122,-0 -12.609,5.098 -12.609,14.127c-0,9.263 5.215,14.205 12.532,14.205c4.164,0 7.083,-1.634 9.068,-3.658l-2.88,-3.697c-1.518,1.206 -3.153,2.413 -5.838,2.413c-3.697,-0 -6.266,-2.763 -6.266,-9.263c-0,-6.616 2.724,-9.379 6.149,-9.379c2.102,-0 3.892,0.778 5.371,1.984l3.113,-3.775c-2.257,-1.868 -4.748,-2.957 -8.64,-2.957Z"/>
|
82 | 82 | </g>
|
@@ -190,7 +190,7 @@ <h3 id="write-our-records-to-kafka" class="section"><a class="anchor-link left"
|
190 | 190 | </span><span class="type-name">ClientId</span><span>(</span><span class="string-literal">"producer-example"</span><span>)
|
191 | 191 | )
|
192 | 192 | </span><span class="comment">// producer: Resource[IO, ProducerApi[IO, org.apache.avro.generic.GenericRecord, org.apache.avro.generic.GenericRecord]] = Allocate(
|
193 |
| -// resource = cats.effect.kernel.Resource$$$Lambda$12057/0x00000001030fb040@3eac6a70 |
| 193 | +// resource = cats.effect.kernel.Resource$$$Lambda$10766/0x0000000102d62840@159872db |
194 | 194 | // )</span></code></pre>
|
195 | 195 | <p>And we'll define some customer records to be written:</p>
|
196 | 196 | <pre><code class="nohighlight"><span class="keyword">import</span><span> </span><span class="identifier">org</span><span>.</span><span class="identifier">apache</span><span>.</span><span class="identifier">kafka</span><span>.</span><span class="identifier">clients</span><span>.</span><span class="identifier">producer</span><span>.</span><span class="type-name">ProducerRecord</span><span>
|
@@ -221,16 +221,16 @@ <h3 id="write-our-records-to-kafka" class="section"><a class="anchor-link left"
|
221 | 221 | <h4 id="writing-typed-records-with-an-avro4s-producer" class="section"><a class="anchor-link left" href="#writing-typed-records-with-an-avro4s-producer"><i class="icofont-laika link"></i></a>Writing typed records with an Avro4s producer</h4>
|
222 | 222 | <p>Turning a generic producer into a typed producer is simple. We first ensure that <code>com.sksamuel.avro4s.RecordFormat</code> instances for our data are in scope:</p>
|
223 | 223 | <pre class="keep-together pdf epub"><code class="nohighlight"><span class="keyword">implicit</span><span> </span><span class="keyword">val</span><span> </span><span class="type-name">CustomerRecordFormat</span><span> = </span><span class="identifier">com</span><span>.</span><span class="identifier">sksamuel</span><span>.</span><span class="identifier">avro4s</span><span>.</span><span class="type-name">RecordFormat</span><span>[</span><span class="type-name">Customer</span><span>]
|
224 |
| -</span><span class="comment">// CustomerRecordFormat: com.sksamuel.avro4s.RecordFormat[Customer] = com.sksamuel.avro4s.RecordFormat$$anon$1@4e1de48d |
| 224 | +</span><span class="comment">// CustomerRecordFormat: com.sksamuel.avro4s.RecordFormat[Customer] = com.sksamuel.avro4s.RecordFormat$$anon$1@271a0f46 |
225 | 225 | </span><span class="keyword">implicit</span><span> </span><span class="keyword">val</span><span> </span><span class="type-name">CustomerIdRecordFormat</span><span> = </span><span class="identifier">com</span><span>.</span><span class="identifier">sksamuel</span><span>.</span><span class="identifier">avro4s</span><span>.</span><span class="type-name">RecordFormat</span><span>[</span><span class="type-name">CustomerId</span><span>]
|
226 |
| -</span><span class="comment">// CustomerIdRecordFormat: com.sksamuel.avro4s.RecordFormat[CustomerId] = com.sksamuel.avro4s.RecordFormat$$anon$1@252d7395</span></code></pre> |
| 226 | +</span><span class="comment">// CustomerIdRecordFormat: com.sksamuel.avro4s.RecordFormat[CustomerId] = com.sksamuel.avro4s.RecordFormat$$anon$1@52a7f1fa</span></code></pre> |
227 | 227 | <p>And with those implicits in scope, we can create our producer:</p>
|
228 | 228 | <pre class="keep-together pdf epub"><code class="nohighlight"><span class="keyword">val</span><span> </span><span class="identifier">avro4sProducer</span><span> = </span><span class="identifier">producer</span><span>.</span><span class="identifier">map</span><span>(</span><span class="identifier">_</span><span>.</span><span class="identifier">toAvro4s</span><span>[</span><span class="type-name">CustomerId</span><span>, </span><span class="type-name">Customer</span><span>])
|
229 | 229 | </span><span class="comment">// avro4sProducer: Resource[IO, ProducerApi[[A]IO[A], CustomerId, Customer]] = Bind(
|
230 | 230 | // source = Allocate(
|
231 |
| -// resource = cats.effect.kernel.Resource$$$Lambda$12057/0x00000001030fb040@3eac6a70 |
| 231 | +// resource = cats.effect.kernel.Resource$$$Lambda$10766/0x0000000102d62840@159872db |
232 | 232 | // ),
|
233 |
| -// fs = cats.effect.kernel.Resource$$Lambda$12185/0x000000010323b840@23914bce |
| 233 | +// fs = cats.effect.kernel.Resource$$Lambda$10894/0x0000000102e6e840@17ef76c3 |
234 | 234 | // )</span></code></pre>
|
235 | 235 | <p>We can now write our typed customer records successfully!</p>
|
236 | 236 | <pre class="keep-together pdf epub"><code class="nohighlight"><span class="keyword">import</span><span> </span><span class="identifier">cats</span><span>.</span><span class="identifier">effect</span><span>.</span><span class="identifier">unsafe</span><span>.</span><span class="identifier">implicits</span><span>.</span><span class="identifier">global</span><span>
|
@@ -259,11 +259,11 @@ <h3 id="read-our-records-from-kafka" class="section"><a class="anchor-link left"
|
259 | 259 | </span><span class="comment">// consumer: Resource[IO, ConsumerApi[IO, CustomerId, Customer]] = Bind(
|
260 | 260 | // source = Bind(
|
261 | 261 | // source = Allocate(
|
262 |
| -// resource = cats.effect.kernel.Resource$$$Lambda$12057/0x00000001030fb040@c6f2ba5 |
| 262 | +// resource = cats.effect.kernel.Resource$$$Lambda$10766/0x0000000102d62840@724a41a |
263 | 263 | // ),
|
264 |
| -// fs = com.banno.kafka.consumer.ConsumerApi$Avro$$$Lambda$12188/0x000000010323d040@281e6984 |
| 264 | +// fs = com.banno.kafka.consumer.ConsumerApi$Avro$$$Lambda$10897/0x0000000102e70840@1d8c3b39 |
265 | 265 | // ),
|
266 |
| -// fs = cats.effect.kernel.Resource$$Lambda$12185/0x000000010323b840@2c602235 |
| 266 | +// fs = cats.effect.kernel.Resource$$Lambda$10894/0x0000000102e6e840@2306a4f |
267 | 267 | // )</span></code></pre>
|
268 | 268 | <p>With our Kafka consumer in hand, we'll assign to our consumer our topic partition, with no offsets, so that it starts reading from the first record, and read a stream of records from our Kafka topic:</p>
|
269 | 269 | <pre class="keep-together pdf epub"><code class="nohighlight"><span class="keyword">import</span><span> </span><span class="identifier">org</span><span>.</span><span class="identifier">apache</span><span>.</span><span class="identifier">kafka</span><span>.</span><span class="identifier">common</span><span>.</span><span class="type-name">TopicPartition</span><span>
|
|
0 commit comments