Skip to main content
Module

x/kafkagosaur/reader.ts>KafkaReader

Kafka client for Deno binding to kafka-go using WebAssembly
Latest
interface KafkaReader
import { type KafkaReader } from "https://deno.land/x/kafkagosaur@v0.0.6/reader.ts";

Properties

close: () => Promise<void>

Closes the stream, preventing the program from reading any more messages from it.

commitMessages: (msgs: KafkaReadMessage[]) => Promise<void>

Commits the list of messages passed as argument.

fetchMessage: () => Promise<KafkaReadMessage>

Reads and return the next message. Does not commit offsets automatically when using consumer groups. Use commitMessages to commit the offset.

readMessage: () => Promise<KafkaReadMessage>

Reads and return the next message. If consumer groups are used, readMessage will automatically commit the offset when called. Note that this could result in an offset being committed before the message is fully processed.

If more fine grained control of when offsets are committed is required, it is recommended to use fetchMessage with commitMessages instead.

setOffset: (offset: number) => Promise<void>

SetOffset changes the offset from which the next batch of messages will be read.

setOffsetAt: (timeMs: number) => Promise<void>

SetOffset changes the offset from which the next batch of messages will be read given the timestamp.

stats: () => string

Stats returns a snapshot of the reader stats since the last time the method was called, or since the reader was created if it is called for the first time.