【问题标题】:Getting kafka topic related issue in spring boot service在 Spring Boot 服务中获取 kafka 主题相关问题
【发布时间】:2022-07-29 07:46:34
【问题描述】:

我们有一个 spring boot 服务在启动时总是出现这个错误:

org.springframework.kafka.KafkaException: Failed to create topics; nested exception is org.apache.kafka.common.errors.TimeoutException: Call(callName=createTopics, deadlineMs=1646313594248, tries=1, nextAllowedTryMs=-9223372036854775709) timed out at 9223372036854775807 after 1 attempt(s)
    at org.springframework.kafka.core.KafkaAdmin.addTopics(KafkaAdmin.java:281) ~[spring-kafka-2.6.7.jar:2.6.7]
    at org.springframework.kafka.core.KafkaAdmin.addTopicsIfNeeded(KafkaAdmin.java:221) ~[spring-kafka-2.6.7.jar:2.6.7]
    at org.springframework.kafka.core.KafkaAdmin.initialize(KafkaAdmin.java:189) [spring-kafka-2.6.7.jar:2.6.7]
    at org.springframework.kafka.core.KafkaAdmin.afterSingletonsInstantiated(KafkaAdmin.java:157) [spring-kafka-2.6.7.jar:2.6.7]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:963) [spring-beans-5.3.6.jar:5.3.6]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) [spring-context-5.3.6.jar:5.3.6]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) [spring-context-5.3.6.jar:5.3.6]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) [spring-boot-2.4.5.jar:2.4.5]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:782) [spring-boot-2.4.5.jar:2.4.5]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:774) [spring-boot-2.4.5.jar:2.4.5]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439) [spring-boot-2.4.5.jar:2.4.5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:339) [spring-boot-2.4.5.jar:2.4.5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1340) [spring-boot-2.4.5.jar:2.4.5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329) [spring-boot-2.4.5.jar:2.4.5]
    at com.medfusion.apt.event.collector.Starter.main(Starter.java:24) [classes/:?]
Caused by: org.apache.kafka.common.errors.TimeoutException: Call(callName=createTopics, deadlineMs=1646313594248, tries=1, nextAllowedTryMs=-9223372036854775709) timed out at 9223372036854775807 after 1 attempt(s)
Caused by: org.apache.kafka.common.errors.TimeoutException: The AdminClient thread has exited.

但是,应用程序继续正确启动。 并非所有服务都发生这种情况,这发生在 3 项服务中。

任何建议,我怎样才能让它消失。

【问题讨论】:

  • 根据错误,无法创建您尝试使用的主题。它可能不会阻止启动,但可能会在以后导致运行时问题
  • 这可能意味着您的应用程序无权访问代理的管理功能 - 您必须与负责该问题的团队核实。
  • @TomazFernandes 是的,这就是问题所在。添加了管理代理相关的属性。它奏效了。谢谢。
  • 我很高兴它成功了。我已经在该评论中添加了答案,因此,如果您认为没问题,您可以将其选为正确的,以便其他人更容易找到它。也可以随意添加任何关于你必须做什么的 cmets。谢谢。

标签: spring-boot apache-kafka kafka-consumer-api spring-kafka


【解决方案1】:

这可能意味着您的应用程序无权访问代理的管理功能 - 您必须与负责该问题的团队核实。

【讨论】:

    【解决方案2】:

    我遇到了同样的错误,想知道如何检查应用程序是否可以访问代理的管理功能?

    该应用程序是一个 Spring Boot 应用程序,我正在尝试使用默认配置自行将其连接到 AWS MSK 设置。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-09-14
      • 2023-03-25
      • 1970-01-01
      • 2022-01-02
      • 2020-01-19
      • 1970-01-01
      • 2019-03-13
      相关资源
      最近更新 更多