Kind: Interface
Source: packages/microservices/external/kafka.interface.ts
Part of: Microservices
ResourceConfigQuery defines a request for retrieving configuration values from a Kafka resource. It identifies the Kafka resource type and name, then specifies which configuration keys should be returned.
Properties
| Property | Type |
|---|---|
type | ConfigResourceTypes |
name | string |
configNames | string[] |
Diagram
mermaidgraph LR Query[ResourceConfigQuery] --> Type[type: ConfigResourceTypes] Query --> Name[name: string] Query --> ConfigNames[configNames: string[]] Type --> Resource[Kafka resource type] Name --> Target[Target resource name] ConfigNames --> Keys[Requested configuration keys]
Usage
tsimport type { ResourceConfigQuery } from './kafka.interface';
import { ConfigResourceTypes } from './kafka.interface';
const topicConfigQuery: ResourceConfigQuery = {
type: ConfigResourceTypes.TOPIC,
name: 'orders.created',
configNames: [
'retention.ms',
'cleanup.policy',
'min.insync.replicas',
],
};
// Pass the query to the Kafka admin/configuration service.
const configs = await kafkaConfigService.describeResourceConfig(topicConfigQuery);
AI Coding Instructions
- Set
typeto the matchingConfigResourceTypesvalue for the target Kafka resource, such as a topic or broker. - Provide the exact Kafka resource identifier in
name; topic names and broker identifiers must match the cluster configuration. - Include only the configuration keys needed in
configNamesto avoid unnecessary admin API requests. - Keep this interface aligned with the Kafka admin client integration that resolves resource configurations.
- Validate or handle missing configuration keys when consuming the returned configuration response.
How it works
ResourceConfigQuery is an exported TypeScript interface in a file declared to represent KafkaJS package types only; it contains no executable implementation. packages/microservices/external/kafka.interface.ts:1-8 packages/microservices/external/kafka.interface.ts:343-347
- It describes one resource entry for
Admin.describeConfigs. That method requires aresourcesarray of these entries and anincludeSynonymsboolean, then returnsPromise<DescribeConfigResponse>. packages/microservices/external/kafka.interface.ts:502-503 packages/microservices/external/kafka.interface.ts:548-551 - Each query must contain:
type: aConfigResourceTypesenum value. The declared values areUNKNOWN(0),TOPIC(2),BROKER(4), andBROKER_LOGGER(8). packages/microservices/external/kafka.interface.ts:295-300 packages/microservices/external/kafka.interface.ts:343-345name: a string. packages/microservices/external/kafka.interface.ts:343-346
- It may contain
configNames, an optional string array. packages/microservices/external/kafka.interface.ts:343-347 - The corresponding response contains resource results with
configEntries, anerrorCode, anerrorMessage, a resource name and type, plus athrottleTime. Individual entries include their name, value, source, default/sensitive/read-only flags, and synonyms. packages/microservices/external/kafka.interface.ts:349-374 - No runtime validation, error throwing, network action, or other side effect is implemented by
ResourceConfigQueryitself in this file; it is only a structural type declaration. packages/microservices/external/kafka.interface.ts:1-8 packages/microservices/external/kafka.interface.ts:343-347
Was this page helpful?