From a717b6c7233e4842faaa8cb3a661ba9c6436f4c0 Mon Sep 17 00:00:00 2001 From: Ask Solem Date: Fri, 9 Sep 2011 13:01:25 +0100 Subject: [PATCH] ProducerPool.Producer: can be used to override the producer type used --- kombu/pools.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/kombu/pools.py b/kombu/pools.py index d0ad2336..42c2ee62 100644 --- a/kombu/pools.py +++ b/kombu/pools.py @@ -14,17 +14,16 @@ def register_group(group): class ProducerPool(Resource): - Producer = Producer def __init__(self, connections, *args, **kwargs): self.connections = connections super(ProducerPool, self).__init__(*args, **kwargs) + def Producer(self, connection): + return Producer(connection) + def create_producer(self): - conn = self.connections.acquire(block=True) - producer = self.Producer(conn) - producer.connection = conn - return producer + return self.Producer(self.connections.acquire(block=True)) def new(self): return lambda: self.create_producer()