Confluent Kafka库是否允许在运行时间创建一个消费者组

发布于 2025-02-11 06:17:09 字数 190 浏览 2 评论 0原文

我需要使用Kafka IADMinclient或任何其他将Kafka曝光的接口创建消费者组。 我了解,通过将true设置为允许。

就我而言,连接到活动中心。在事件中心,我们需要明确创建一个消费者组。如果在消耗消息时未指定消费者组,则使用$默认的消费者组。如果我提供事件中心中不存在的消费者组,则它会引发错误。

你们能把我带走正确的道路吗?

I have requirement to create consumer group at run time using Kafka IAdminClient or any other interfaces which Confluent Kafka exposes.
I understand that by setting true to allow.auto.create.topics will solve my requirement.

In my case am connecting to Event hub. In Event hub we need to explicitly create a consumer group. If no consumer group is specified while consuming the message it uses the $Default consumer group. If i provide the consumer group which does not exist in event hub then its throws an error.

Can you guys drive me in a right path?

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

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

发布评论

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

评论(1

南烟 2025-02-18 06:17:09

AdmInclient不负责创建群体。唯一的方法是通过groupId config将消费者订阅主题。

如果您只想初始化一个空的组,请订阅消费者,将其从进行轮询时开始的偏移量,然后将其提交该组的偏移量。所有这些都是通过消费者实例完成的。

在事件中心,我们需要明确创建一个消费者组。

然后,您需要一个EventHub API客户端进行此操作,因为Kafka不在乎现有的组。如果不存在,将创建一个。

AdminClient isn't responsible for creation of groups. Only way to do that is subscribing consumers to topics with a GroupId config.

If you just want to initialize an empty group, subscribe a consumer, seek it to the offset you'd like it to start from when it does poll, then commit that offset for the group. All of that is done via a Consumer instance.

In Event hub we need to explicitly create a consumer group.

Then you'd need an EventHub API client for this action, since Kafka doesn't care about existing groups; one will be created if it doesn't exist.

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