【Azure Event Hub】Kafka消息发送失败(Timeout Exception) - LuBu0505/My-Code GitHub Wiki

问题描述

使用Azure Event Hub,客户端通过kafka发送消息到Event Hub中,规律性的遇见Timeout Exception

" send fail; nested exception is org.springframework.kafka.kafkaException: xxx" image.png

问题解答

Kafka客户端与Event Hub服务端的连接(Connection)空闲事件过长,Event Hub服务端会自动关闭Idle时间达到4分钟的连接,进而导致之后再通过这个connection进行的请求无法完成且报错,在修改了connections.max.idle.ms 这个参数为180000 后解决。

Azure closes inbound Transmission Control Protocol (TCP) idle > 240,000 ms, which can result in sending on dead connections (shown as expired batches because of send timeout). image.png

参考资料

Java client configuration properties : https://learn.microsoft.com/en-us/azure/event-hubs/apache-kafka-configurations#java-client-configuration-properties

当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!