@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.
41 lines • 1.29 kB
TypeScript
import type { RetryConfig } from '@ydbjs/retry';
import type { CompressionCodec } from '../codec.js';
import type { TX } from '../tx.js';
export type ThroughputSettings = {
maxBufferBytes: bigint;
flushIntervalMs: number;
maxInflightCount: number;
};
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 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 interface TopicTxWriter {
write(payload: Uint8Array, extra?: {
seqNo?: bigint;
createdAt?: Date;
metadataItems?: Record<string, Uint8Array>;
}): bigint;
flush(): Promise<bigint | undefined>;
close(): Promise<void>;
destroy(): void;
}
//# sourceMappingURL=types.d.ts.map