第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

啟動(dòng)springboot服務(wù)器時(shí)如何繞過(guò)kafka代理失???

啟動(dòng)springboot服務(wù)器時(shí)如何繞過(guò)kafka代理失???

瀟瀟雨雨 2023-09-27 10:16:35
我在 spring-boot(2.1.7.RELEASE) 應(yīng)用程序服務(wù)器中遇到問(wèn)題,該服務(wù)器使用 spring-boot-Kafka('spring-Kafka' -'2.2.7.RELEASE') 集成庫(kù)來(lái)訪問(wèn)我的 Kafka 主題。當(dāng)我的 Kafka 代理關(guān)閉時(shí),我的應(yīng)用程序無(wú)法啟動(dòng)。這就是我得到的:2019-10-06 02:41:02.764  WARN -- [main           ] org.apache.kafka.clients.NetworkClient                       [] : [Consumer clientId=consumer-1, groupId=caas] Connection to node -1 could not be established. Broker may not be available.Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.2019-10-06 02:41:31.777 ERROR -- [main           ] org.springframework.boot.SpringApplication                   [] : Application run failedorg.springframework.context.ApplicationContextException: Failed to start bean 'org.springframework.kafka.config.internalKafkaListenerEndpointRegistry'; nested exception is org.apache.kafka.common.errors.TimeoutException: Timeout expired while fetching topic metadata    at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:185)    at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53)    at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360)    at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158)    at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122)    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:893)    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:162)    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552)有沒(méi)有辦法繞過(guò)對(duì) Kafka 代理的依賴?即使經(jīng)紀(jì)人不可用/關(guān)閉,我也希望我的應(yīng)用程序能夠啟動(dòng)。一旦代理啟動(dòng),應(yīng)用程序服務(wù)器應(yīng)該能夠連接。
查看完整描述

2 回答

?
弒天下

TA貢獻(xiàn)1818條經(jīng)驗(yàn) 獲得超8個(gè)贊

有一個(gè)容器屬性missingTopicsFatal: https://docs.spring.io/spring-kafka/api/org/springframework/kafka/listener/ContainerProperties.html#isMissingTopicsFatal - 即使主題和/或經(jīng)紀(jì)人不可用。

@Bean(name = "kafkaListenerContainerFactory")

public ConcurrentKafkaListenerContainerFactory<?, ?> kafkaListenerContainerFactory(

    ConsumerFactory<Object, Object> kafkaConsumerFactor,

    ConcurrentKafkaListenerContainerFactoryConfigurer configurer) {


  ConcurrentKafkaListenerContainerFactory<Object, Object> factory =

      new ConcurrentKafkaListenerContainerFactory<>();

  configurer.configure(factory, kafkaConsumerFactor);


  ContainerProperties containerProperties = factory.getContainerProperties();

  containerProperties.setMissingTopicsFatal(false);


  ...

  return factory;

}


查看完整回答
反對(duì) 回復(fù) 2023-09-27
?
慕勒3428872

TA貢獻(xiàn)1848條經(jīng)驗(yàn) 獲得超6個(gè)贊

這是新版本的spring的變化。


@Component

class ContainerFactoryConfigurer {


    ContainerFactoryConfigurer(ConcurrentKafkaListenerContainerFactory<?, ?> factory) {

        factory.getContainerProperties().setMissingTopicsFatal(false);

    }


}


查看完整回答
反對(duì) 回復(fù) 2023-09-27
  • 2 回答
  • 0 關(guān)注
  • 142 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)