'Python KafkaConsumer Unable to receive messages
I have written code in Python to connect to Kafka using KafkaConsumer.
We have 2 different environments for Kafka SIT And UAT.
Everything is working fine till SIT environment. As as soon as I tried connecting to UAT Kafka server the same code is not consuming any messages.
The producer in SIT and UAT environment is same. Also I see in Kafka Control center consumption in bytes but no messages are fetched from UAT ( Offset still remains the same which says 682 messages lagging).
If I switch bootstrap server back to SIT, I start getting messages but the same thing is not happening with UAT bootstrap server.
There is no error and the script compete to success everytime. Here is the code snippet
import json
import SSL
from Kafka import KafkaConsumer
consumer = KafkaConsumer('TopicName', bootstrap_server='ServerName', enable_auto_commit=True, group_id='grpid', consumer_timeout_ms=60000, value_deserializer=json.loads(m.decode('utf-8')))
for message in consumer:
print(str(message.value))
consumer.close()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
