We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Would be nice to be able to use a with statement to close the connections:
with
with KafkaProducer(...) as producer: producer.send(...)
Instead of try/finally:
try/finally
producer = KafkaProducer(...) try: producer.send(...) finally: producer.close()
Just add this code to KafkaProducer, KafkaConsumer, KafkaClient, KafkaAdminClient:
KafkaProducer, KafkaConsumer, KafkaClient, KafkaAdminClient
def __enter__(self): return self def __exit__(self, exc_type, exc_value, traceback): self.close()
I tried to push a PR for you to save the trouble, but was denied.
The text was updated successfully, but these errors were encountered:
protip:
from contextlib import closing with closing(KafkaProducer(...)) as producer: producer.send(...)
Sorry, something went wrong.
No branches or pull requests
Would be nice to be able to use a
with
statement to close the connections:Instead of
try/finally
:Just add this code to
KafkaProducer, KafkaConsumer, KafkaClient, KafkaAdminClient
:I tried to push a PR for you to save the trouble, but was denied.
The text was updated successfully, but these errors were encountered: