微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决@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 举报,一经查实,本站将立刻删除。