【发布时间】:2021-08-16 22:47:16
【问题描述】:
我需要帮助一位使用 Spring Boot 的消费者。我需要在断开连接时停止应用程序,例如 10 分钟。什么时候断开
2021-08-16 18:39:21.927 WARN 15548 --- [ntainer#0-0-C-1] o.a.k.c.NetworkClient : [Consumer clientId=topicTest, groupId=goupTest-] Connection to node 1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available.
2021-08-16 18:39:24.942 WARN 15548 --- [ntainer#0-0-C-1] o.a.k.c.NetworkClient : [Consumer clientId=topicTest, groupId=goupTest] Connection to node 1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available.
2021-08-16 18:39:24.943 INFO 15548 --- [ntainer#0-0-C-1] o.a.k.c.FetchSessionHandler : [Consumer clientId=topicTest, groupId=goupTest] Error sending fetch request (sessionId=1591961485, epoch=INITIAL) to node 1:
org.apache.kafka.common.errors.DisconnectException: null
或无法连接时
2021-08-16 18:42:15.960 WARN 23068 --- [ntainer#0-0-C-1] o.a.k.c.NetworkClient : [Consumer clientId=topicTest, groupId=goupTest] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available.
2021-08-16 18:42:15.961 WARN 23068 --- [ntainer#0-0-C-1] o.a.k.c.NetworkClient : [Consumer clientId=topicTest, groupId=goupTest] Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected
2021-08-16 18:42:19.125 WARN 23068 --- [ntainer#0-0-C-1] o.a.k.c.NetworkClient : [Consumer clientId=topicTest, groupId=goupTest] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available.
2021-08-16 18:42:19.126 WARN 23068 --- [ntainer#0-0-C-1] o.a.k.c.NetworkClient : [Consumer clientId=topicTest, groupId=goupTest] Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected
我将 ConsumerFactory 和 ConcurrentKafkaListenerContainerFactory 用于我的消费者的所有配置
【问题讨论】:
标签: spring spring-boot apache-kafka consumer