@ydbjs/topic
Version:
YDB Topics client for publish-subscribe messaging. Provides at-least-once delivery, exactly-once publishing, FIFO guarantees, and scalable message processing for unstructured data.
33 lines • 1.27 kB
TypeScript
import type { Driver } from '@ydbjs/core';
import { type RetryConfig } from '@ydbjs/retry';
import { type CompressionCodec } from '../codec.js';
import type { TX } from '../tx.js';
export type TopicWriterOptions = {
tx?: TX;
topic: string;
codec?: CompressionCodec;
producer?: string;
updateTokenIntervalMs?: number;
maxBufferBytes?: bigint;
maxInflightCount?: number;
flushIntervalMs?: number;
retryConfig?(signal: AbortSignal): RetryConfig;
onAck?: (seqNo: bigint, status?: 'skipped' | 'written' | 'writtenInTx') => void;
};
export interface TopicWriter extends Disposable, AsyncDisposable {
write(payload: Uint8Array, extra?: {
seqNo?: bigint;
createdAt?: Date;
metadataItems?: Record<string, Uint8Array>;
}): bigint;
flush(): Promise<bigint | undefined>;
close(): Promise<void>;
destroy(reason?: Error): void;
}
export declare const createTopicWriter: (driver: Driver, options: TopicWriterOptions) => TopicWriter;
export declare const createTopicTxWriter: (driver: Driver, tx: {
registerPrecommitHook: (fn: () => Promise<void> | void) => void;
sessionId: string;
transactionId: string;
}, options: TopicWriterOptions) => TopicWriter;
//# sourceMappingURL=index.d.ts.map