python kafka消费者超时参数_Python - Kafka:消费者失败(Python - Kafka: consumer failing)

I have a simple Producer-Consumer setup: 1 producer(as a thread) and 2 consumers(as 2 processes). The run method of producer:

def run(self):

producer = KafkaProducer(bootstrap_servers=self.bootstrap_servers,

api_version=(0, 10))

while not self.stop_event.is_set():

self.logger.info("Checking for new changes")

self.check_for_new_changes(producer)

self.logger.info("Sleeping for {minutes}

minutes...".format(minutes=self.time_to_sleep / 60))

time.sleep(self.time_to_sleep)

producer.close()

Basically it checks for changes, sends messages if new changes found and then goes to sleep for 5 minutes.

The run method:

def run(self):

if self.group_id:

consumer = KafkaConsumer(bootstrap_servers=self.bootstrap_servers,

consumer_timeout_ms=1000,

api_version=(0, 10),

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值