Kind: Interface
Source: packages/microservices/external/kafka.interface.ts
Part of: Microservices
IResourceConfig defines the configuration payload for a Kafka resource, such as a topic, broker, or other configurable Kafka entity. It combines the resource type and name with a collection of individual configuration entries that should be applied or managed by the external Kafka integration.
Properties
| Property | Type |
|---|---|
type | ConfigResourceTypes |
name | string |
configEntries | IResourceConfigEntry[] |
Diagram
mermaidgraph LR A[IResourceConfig] --> B[type: ConfigResourceTypes] A --> C[name: string] A --> D[configEntries: IResourceConfigEntry[]] D --> E[Kafka resource configuration values]
Usage
tsimport type {
IResourceConfig,
ConfigResourceTypes,
} from './kafka.interface';
const topicConfig: IResourceConfig = {
type: ConfigResourceTypes.TOPIC,
name: 'orders.events',
configEntries: [
{
name: 'retention.ms',
value: '604800000',
},
{
name: 'cleanup.policy',
value: 'delete',
},
],
};
// Pass the resource configuration to the Kafka administration layer.
await kafkaAdmin.updateResourceConfig(topicConfig);
AI Coding Instructions
- Set
typeto the Kafka resource category represented byConfigResourceTypes; ensure it matches the target resource being configured. - Use the exact Kafka resource identifier in
name, such as a topic name, because configuration updates are applied to that named resource. - Populate
configEntrieswith validIResourceConfigEntryobjects and Kafka-supported configuration keys. - Keep configuration values in the expected serialized format, typically strings, to match Kafka Admin API conventions.
- Route
IResourceConfigobjects through the existing Kafka administration or external microservice integration rather than applying configuration changes directly.
Was this page helpful?