Deactivate auto reconnect for consumer
See original GitHub issueHere is the problem
Sample code: use the next iterator, and go through. I handle my own timeouts, retries, what I do, when I commit (one message at a time), what I log, etc.
from kafka import KafkaConsumer
consumer = KafkaConsumer('mytopic', boostrap_servers='myserver', consumer_timeout_ms=1000, enable_auto_commit=False)
while True:
try:
print "start iteration"
data = next(consumer)
# do some processing, and if it went well, commit
consumer.commit()
except StopIteration:
print "cycle back"
For normal processing, when kafka is running fine, it will print start interation, cycle back every second if I don’t have any new messages in my kafka topic, except that if I stop kafka, it will block at the next(consumer) forever. And then if I restart kafka, it will reconnect and do as if nothing had gone wrong.
How can I stop the “magic” behavior? I’d like it to just throw an exception if it disconnects, and let me do the reconnect on my own terms.
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Disable auto reconnect network drive on boot - TechNet
Every time I boot Windows 7 now, I get a popup saying Windows 7 was unable to auto reconnect network drives . In...
Read more >How to avoid automatic reconnect to data sources at startup?
My question is about the following scenario. I close Data Studio (4.1.1 / Linux) with some SQL Script files open that are connected...
Read more >How do I disable auto connect from WiFi? - Quora
In Windows 10, there are two ways of doing this: 1. Click on the network icon, select the network and untick the “Connect...
Read more >spring - Activemq consumer can not reconnect automatically
PooledConnectionFactory closes sessions/consumer connection after the consumer has processed messages.Hence the consumer count keeps ...
Read more >How to enable/disable the Auto-Connect to a database feature ...
How to enable or disable the Auto-Connect to a specified database feature? How to stop Toad from auto-connecting to my schema?
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Or an error event. If the client can’t connect to any broker at all, I’d like to know that. Perhaps there is a network issue on something, and I’d like to issue a warning so that someone can take action, or maybe just be aware that the client isn’t able to connect and possibly delayed.
Although unrelated to the original issue, that is a definite bug, we shouldn’t cache those IP’s forever. However, IIRC since this issue was last updated there have been a number of fixes to DNS resolution that have been merged.
I’m going to close this. If you can replicate this issue with the
2.x
series, please open a new ticket and lets get it fixed.