@Embedded Kafka - 使用构造函数创建主题与启用自动创建主题

问题描述

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

  • 在@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)) | 

我想知道使用两种方法有什么区别,以及为什么自动创建方法花费的时间太长????

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)