Kind: Interface
Source: packages/microservices/interfaces/microservice-configuration.interface.ts
Part of: Microservices
KafkaParserConfig defines parser behavior for Kafka message payloads within the microservices configuration layer. Its keepBinary flag controls whether incoming Kafka values remain in their binary form instead of being converted during parsing.
Properties
| Property | Type |
|---|---|
keepBinary | boolean |
Diagram
mermaidgraph LR A[Kafka Consumer] --> B[Kafka Message Value] B --> C[KafkaParserConfig] C -->|keepBinary: true| D[Preserve Binary Payload] C -->|keepBinary: false| E[Parse/Convert Payload] D --> F[Microservice Handler] E --> F
Usage
tsimport type { KafkaParserConfig } from './interfaces/microservice-configuration.interface';
const parserConfig: KafkaParserConfig = {
keepBinary: true,
};
// Use this when configuring a Kafka consumer/parser that must receive
// raw Buffer payloads, such as protobuf, Avro, or encrypted messages.
AI Coding Instructions
- Set
keepBinary: truewhen handlers need access to the raw KafkaBufferpayload. - Use
keepBinary: falsewhen message values should be parsed or converted before reaching application handlers. - Ensure downstream handlers match the configured payload type; binary payloads should not be treated as JSON strings without decoding.
- Keep this configuration aligned with the message serializer and deserializer used by Kafka producers and consumers.
Was this page helpful?