mirror of https://github.com/celery/kombu.git
Producer now works as a context manager.
This commit is contained in:
parent
4faf662d4f
commit
65dc58505a
|
@ -138,6 +138,12 @@ class Producer(object):
|
|||
self.channel = channel
|
||||
self.exchange.revive(channel)
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, *exc_info):
|
||||
self.close()
|
||||
|
||||
def close(self):
|
||||
pass
|
||||
|
||||
|
|
Loading…
Reference in New Issue