UNPKG

node-test-bed-adapter

Version:

An adapter to connect a node.js application to the Test-bed's Common Information Space or Common Simulation Space.

27 lines (26 loc) 1.01 kB
import { SchemaRegistry } from '../avro/schema-registry.mjs'; import { Type } from 'avsc'; /** * Encode an AVRO value into a message, as expected by Confluent's Kafka Avro deserializer. * * @param val The Avro value to encode. * @param type Your value's Avro type. * @param schemaId Your schema's ID (inside the registry). * @param optLength Optional initial buffer length. Set it high enough to avoid having to resize. Defaults to 1024. * @return {Buffer} Serialized value. */ export declare const toMessageBuffer: (val: any, type: Type, schemaId: number, optLength?: number) => Buffer; /** * Decode a confluent SR message with magic byte. * * @param {avsc.Type} type The topic's Avro decoder. * @param {Buffer} encodedMessage The incoming message. * @param {SchemaRegistry} sr The schema registry. */ export declare const fromMessageBuffer: (type: Type, encodedMessage: Buffer, sr: SchemaRegistry) => { value: undefined; schemaId: undefined; } | { value: any; schemaId: number; };