要解锁耗电元件生成器,fetch_max_wait_ms不工作

2024-03-28 16:51:07 发布

您现在位置:Python中文网/ 问答频道 /正文

我希望我的消费者等待5毫秒,然后解锁。这是我的密码

consumer = KafkaConsumer(
     bootstrap_servers=['192.168.0.100:9092'],
     auto_offset_reset='latest',
     enable_auto_commit=True,
      api_version=(2, 0  , 2),
     group_id='group4',
    fetch_max_wait_ms=5)
consumer.subscribe(['topic1'])

next(consumer,0)

但是,next(consumer,0)正在等待数据到达

我没有更改任何配置,因为here说我可以通过python来完成

有什么想法吗