Implement connection revive() for kombu.compat classes

This commit is contained in:
Ask Solem 2011-01-07 11:11:22 +01:00
parent dabfcbadf8
commit 387e979840
1 changed files with 12 additions and 0 deletions

View File

@ -100,6 +100,10 @@ class Publisher(messaging.Producer):
def send(self, *args, **kwargs):
return self.publish(*args, **kwargs)
def revive(self, channel):
self.backend = channel
super(Publisher, self).revive(channel)
def close(self):
self.backend.close()
self._closed = True
@ -153,6 +157,10 @@ class Consumer(messaging.Consumer):
auto_delete=self.auto_delete)
super(Consumer, self).__init__(self.backend, queue, **kwargs)
def revive(self, channel):
self.backend = channel
super(Consumer, self).revive(channel)
def close(self):
self.cancel()
self.backend.close()
@ -233,6 +241,10 @@ class ConsumerSet(messaging.Consumer):
for queue in consumer.queues:
self.queues.append(queue(self.channel))
def revive(self, channel):
self.backend = channel
super(ConsumerSet, self).revive(channel)
def close(self):
self.cancel()
self.channel.close()