dou426098 2019-08-27 10:11
浏览 193

使用kafka-go安排在Kafka中创建消费者的时间表

I am new to kafka and currently working on it. I am using kafka-go in golang to create producer and consumer. Currently i am able to create a producer but i want consumer to be created once a producer of a topic is created and not every time. means for each topic, a consumer is created only once. Also, when there is a need of creating more consumer for a topic to balance load, it gets created. Is there any way to schedule that, either through goroutines or Faktory?

  • 写回答

1条回答 默认 最新

  • du0531 2019-08-27 11:30
    关注

    You should not have a coupled producer/consumer, Kafka let you have totally decoupled producer / consumer.

    You can run your consumer even if the topic does not exists ( Kafka will create it, you'll just get an leader unavailable warning ), and run your producer whenever you want.

    Regarding scaling, the idea is that you create as many partition as you might want your topic to be scaled ( in number of consumers).

    Here is some reading about topic partition strategy: https://blog.newrelic.com/engineering/effective-strategies-kafka-topic-partitioning/

    You have lot of readings about this on the web.

    Yannick

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog