UNPKG

@alexknips/nestjs-kafka-events

Version:

Lightweight, tested, straight-forward wrapper around KafkaJS and Confluent's Schema Registry.

17 lines (16 loc) 693 B
import { Message } from 'kafkajs'; import { EmitKafkaEventPayload, IKafkaModuleSchemaRegistryConfiguration } from '../interfaces'; import { KafkaLogger } from '../loggers'; export declare class KafkaSerializer { private readonly kafkaLogger; private schemaRegistry; schemas: Map<string, { keyId: number | null; valueId: number; }>; constructor(kafkaLogger: KafkaLogger); initialize(configuration: IKafkaModuleSchemaRegistryConfiguration, topics: string[]): Promise<void>; private fetchAllSchemaIds; private fetchSchemaIds; serialize<V, K>(value: EmitKafkaEventPayload<V, K> & Omit<Message, 'key' | 'value'>): Promise<Message | undefined>; }