如何在kafka主题/分区&中找不到更多消息仅在写完主题后阅读 [英] How to find no more messages in kafka topic/partition & reading only after writing to topic is done

查看:89
本文介绍了如何在kafka主题/分区&中找不到更多消息仅在写完主题后阅读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Spring Boot 1.5.4.RELEASE&Kafka春季版1.3.8.RELEASE.

I'm using Spring boot version 1.5.4.RELEASE & spring Kafka version 1.3.8.RELEASE.

一些通用问题

  1. 是否可以在以下主题/分区中找到更多消息?消费者
  2. 如何启动使用者以开始使用来自只有在制作人写完之后才写主题吗?

推荐答案

Spring Boot 1.5的生命周期已结束,不再受支持.当前版本是2.2.5.

Spring Boot 1.5 is end of life and no longer supported; the current version is 2.2.5.

Apache Kafka的Spring的最新1.3.x版本是1.3.10.仅在今年年底之前将获得支持.

The latest 1.3.x version of Spring for Apache Kafka is 1.3.10. It will only be supported through the end of this year.

您应该计划升级.

您可以使用 KafkaListenerEndpointRegistry bean启动和停止容器;在容器工厂上将 autoStartup 设置为 false .

You can start and stop containers using the KafkaListenerEndpointRegistry bean; set autoStartup to false on the container factory.

请参见检测空闲和无响应的消费者.

虽然效率很高,但异步使用者的一个问题是检测它们何时处于空闲状态-如果一段时间内没有消息到达,用户可能希望采取某些措施.

While efficient, one problem with asynchronous consumers is detecting when they are idle - users might want to take some action if no messages arrive for some period of time.

您可以将侦听器容器配置为在没有邮件传递的一段时间过去后发布 ListenerContainerIdleEvent .容器空闲时,每隔 idleEventInterval 毫秒将发布一个事件.

You can configure the listener container to publish a ListenerContainerIdleEvent when some time passes with no message delivery. While the container is idle, an event will be published every idleEventInterval milliseconds.

...

这篇关于如何在kafka主题/分区&中找不到更多消息仅在写完主题后阅读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆