Kafka消费者如何强制刷新元数据以发现新主题
我正在使用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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
唯一的API是
.close()
消费者和re-订阅
在接收此类“通知事件”后The only API for this would be to
.close()
the consumer and re-subscribe
it upon receiving such "notification event"