mirror of https://github.com/celery/kombu.git
ProducerPool.Producer: can be used to override the producer type used
This commit is contained in:
parent
20ef0d1790
commit
a717b6c723
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue