UNPKG

@platformatic/kafka

Version:

Modern and performant client for Apache Kafka

82 lines (81 loc) 5.16 kB
import { Readable } from 'node:stream'; import { type CallbackWithPromise } from '../../apis/callbacks.ts'; import { type Message } from '../../protocol/records.ts'; import { kAutocommit, kInstance, kRefreshOffsetsAndFetch } from '../../symbols.ts'; import { kInspect } from '../base/base.ts'; import { type Consumer } from './consumer.ts'; import { type CommitOptionsPartition, type ConsumeOptions } from './types.ts'; export declare function noopDeserializer(data?: Buffer): Buffer | undefined; export declare function defaultCorruptedMessageHandler(): boolean; export declare class MessagesStream<Key, Value, HeaderKey, HeaderValue> extends Readable { #private; [kInstance]: number; constructor(consumer: Consumer<Key, Value, HeaderKey, HeaderValue>, options: ConsumeOptions<Key, Value, HeaderKey, HeaderValue>); get offsetsToFetch(): Map<string, bigint>; get offsetsToCommit(): Map<string, CommitOptionsPartition>; get offsetsCommitted(): Map<string, bigint>; get committedOffsets(): Map<string, bigint>; close(callback: CallbackWithPromise<void>): void; close(): Promise<void>; isActive(): boolean; isConnected(): boolean; resume(): this; pause(): this; addListener(event: 'autocommit', listener: (err: Error, offsets: CommitOptionsPartition[]) => void): this; addListener(event: 'fetch', listener: () => void): this; addListener(event: 'offsets', listener: () => void): this; addListener(event: 'data', listener: (message: Message<Key, Value, HeaderKey, HeaderValue>) => void): this; addListener(event: 'close', listener: () => void): this; addListener(event: 'end', listener: () => void): this; addListener(event: 'error', listener: (err: Error) => void): this; addListener(event: 'pause', listener: () => void): this; addListener(event: 'readable', listener: () => void): this; addListener(event: 'resume', listener: () => void): this; on(event: 'autocommit', listener: (err: Error, offsets: CommitOptionsPartition[]) => void): this; on(event: 'fetch', listener: () => void): this; on(event: 'offsets', listener: () => void): this; on(event: 'data', listener: (message: Message<Key, Value, HeaderKey, HeaderValue>) => void): this; on(event: 'close', listener: () => void): this; on(event: 'end', listener: () => void): this; on(event: 'error', listener: (err: Error) => void): this; on(event: 'pause', listener: () => void): this; on(event: 'readable', listener: () => void): this; on(event: 'resume', listener: () => void): this; once(event: 'autocommit', listener: (err: Error, offsets: CommitOptionsPartition[]) => void): this; once(event: 'fetch', listener: () => void): this; once(event: 'offsets', listener: () => void): this; once(event: 'data', listener: (message: Message<Key, Value, HeaderKey, HeaderValue>) => void): this; once(event: 'close', listener: () => void): this; once(event: 'end', listener: () => void): this; once(event: 'error', listener: (err: Error) => void): this; once(event: 'pause', listener: () => void): this; once(event: 'readable', listener: () => void): this; once(event: 'resume', listener: () => void): this; prependListener(event: 'autocommit', listener: (err: Error, offsets: CommitOptionsPartition[]) => void): this; prependListener(event: 'fetch', listener: () => void): this; prependListener(event: 'offsets', listener: () => void): this; prependListener(event: 'data', listener: (message: Message<Key, Value, HeaderKey, HeaderValue>) => void): this; prependListener(event: 'close', listener: () => void): this; prependListener(event: 'end', listener: () => void): this; prependListener(event: 'error', listener: (err: Error) => void): this; prependListener(event: 'pause', listener: () => void): this; prependListener(event: 'readable', listener: () => void): this; prependListener(event: 'resume', listener: () => void): this; prependOnceListener(event: 'autocommit', listener: (err: Error, offsets: CommitOptionsPartition[]) => void): this; prependOnceListener(event: 'fetch', listener: () => void): this; prependOnceListener(event: 'offsets', listener: () => void): this; prependOnceListener(event: 'data', listener: (message: Message<Key, Value, HeaderKey, HeaderValue>) => void): this; prependOnceListener(event: 'close', listener: () => void): this; prependOnceListener(event: 'end', listener: () => void): this; prependOnceListener(event: 'error', listener: (err: Error) => void): this; prependOnceListener(event: 'pause', listener: () => void): this; prependOnceListener(event: 'readable', listener: () => void): this; prependOnceListener(event: 'resume', listener: () => void): this; [Symbol.asyncIterator](): NodeJS.AsyncIterator<Message<Key, Value, HeaderKey, HeaderValue>>; _construct(callback: (error?: Error) => void): void; _destroy(error: Error | null, callback: (error?: Error | null) => void): void; _read(): void; [kAutocommit](): void; [kRefreshOffsetsAndFetch](): void; [kInspect](...args: unknown[]): void; }