consumer consuming the same message twice at the s

2019-08-19 09:12发布

问题:

At the very first consuming, my consumer is consuming the same message twice, this only happens at the first consuming, after that it only consumes once.


Attaching the consumer conf code below. please check for the corrections

def __init__(self, group_id, topic='default', bootstrap_servers= 
['localhost:9092']):
        self.topic = topic
        self.bootstrap_servers = bootstrap_servers
        self.group_id = group_id
        self.consumer = KafkaConsumer(## Heading ##
            self.topic,
            bootstrap_servers=self.bootstrap_servers,
            auto_offset_reset='earliest',
            enable_auto_commit=True,
            group_id=self.group_id,
            value_deserializer=lambda x: loads(x.decode('utf-8')))