Kind: Interface
Source: packages/microservices/external/kafka.interface.ts
Part of: Microservices
KafkaJSDeleteGroupsErrorGroups represents an error returned for a specific Kafka consumer group during a delete-groups operation. It identifies the affected group and provides both the Kafka protocol error code and the associated KafkaJSError details for handling or logging failures.
Properties
| Property | Type |
|---|---|
groupId | string |
errorCode | number |
error | KafkaJSError |
Diagram
mermaidgraph LR DeleteGroups[Kafka delete groups response] --> GroupError[KafkaJSDeleteGroupsErrorGroups] GroupError --> GroupId[groupId: string] GroupError --> ErrorCode[errorCode: number] GroupError --> Error[error: KafkaJSError]
Usage
tsimport { KafkaJSError } from 'kafkajs';
import { KafkaJSDeleteGroupsErrorGroups } from './kafka.interface';
function handleDeleteGroupError(
groupError: KafkaJSDeleteGroupsErrorGroups,
): void {
console.error(
`Failed to delete consumer group "${groupError.groupId}" ` +
`(Kafka error code: ${groupError.errorCode})`,
groupError.error,
);
if (groupError.error instanceof KafkaJSError) {
// Retry, alert, or map the Kafka error to an application-level response.
}
}
AI Coding Instructions
- Treat each interface instance as the failure result for one consumer group, even when a delete operation targets multiple groups.
- Use
groupIdwhen logging or reporting failures so operators can identify the affected consumer group. - Preserve both
errorCodeanderror; the numeric code supports protocol-level handling, whileKafkaJSErrorcontains diagnostic context. - Handle delete-group failures individually rather than assuming the entire batch operation succeeded or failed uniformly.
Was this page helpful?