Kafka消费者如何强制刷新元数据以发现新主题

发布于 2025-02-11 11:23:24 字数 251 浏览 1 评论 0原文

我正在使用Regex模式来订阅一组主题,这些主题可能是动态创建的。但是,消费者发现新创建的主题可能还有很长一段时间。

我可以设置topic.metadata.refresh.interval.ms属性以更改轮询间隔,但是我担心短时间间隔可能会导致开销。因此,我认为通知方法会更好,即,当创建一个新主题时,创建者将通知消费者服务。

我正在寻找一种API,强迫消费者刷新其主题元数据。查看Kafka消费者API后,没有找到一个想法吗?

I'm using regex pattern to subscribe a group of topics, which might be created dynamically. However, there might be quite a while before the consumer discovers the new created topics.

I can set the topic.metadata.refresh.interval.ms property to change the polling intervals, but I'm concerned that short intervals might lead to overhead. So I think a notification approach would be better, i.e, when a new topic is created, the creator will notify the consumer service.

I'm looking for an API forcing the consumer to refresh its topic metadata. Didn't find a after looking through kafka Consumer APIs...any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

柠檬 2025-02-18 11:23:24

唯一的API是.close()消费者和re- 订阅在接收此类“通知事件”后

The only API for this would be to .close() the consumer and re-subscribe it upon receiving such "notification event"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文