0

嗨,我正在使用 @EmbeddedKafka 在 Spring Boot 中进行集成测试。使用以下两种方法创建主题时面临挑战。

  • 在@EmbeddedKafka 注解中使用主题属性
  • 使用auto.create.topic.enable=true

使用auto.create.topic.enable=true时,创建主题大约需要 1.5 分钟。

timeestamp=2021-07-07 22:39:08.443  app= tid= sid= psid= hostname= process=4243 thread=[Test worker] logger=c.t.f.m.MessagingConfiguration method=getObjectMapper line=143 ] | no bean 'messageConverter' found - No bean named 'messageConverter' available, using default mapper | 
[ timestamp=2021-07-07 22:40:42.584  app= tid= sid= psid= hostname= process=4243 thread=[data-plane-kafka-request-handler-6] logger=k.z.AdminZkClient method=info line=66 ] | Creating topic TOPIC_TEST with configuration {} and initial partition assignment Map(0 -> ArrayBuffer(0))

使用属性创建主题时,它工作正常

[ timestamp=2021-07-07 22:40:42.771  app= tid= sid= psid= hostname= process=4243 thread=[data-plane-kafka-request-handler-4] logger=k.c.Partition method=info line=66 ] | [Partition FULFILMENT_ORDER-0 broker=0] FULFILMENT_ORDER-0 starts at leader epoch 0 from offset 0 with high watermark 0. Previous leader epoch was -1. | 
[ timestamp=2021-07-07 22:42:13.362  app= tid= sid= psid= hostname= process=4243 thread=[data-plane-kafka-request-handler-4] logger=k.z.AdminZkClient method=info line=66 ] | Creating topic TOPIC_TEST with configuration {} and initial partition assignment Map(0 -> ArrayBuffer(0)) | 

我想知道使用两种方法有什么区别,为什么自动创建方法需要很长时间????

4

0 回答 0