General Pools - kombu.pools

class kombu.pools.ProducerPool(connections, *args, **kwargs)
class Producer(channel, exchange=None, routing_key=None, serializer=None, auto_declare=None, compression=None, on_return=None)

Message Producer.

Parameters:
  • channel – Connection channel.
  • exchange – Default exchange.
  • routing_key – Default routing key.
  • serializer – Default serializer. Default is “json”.
  • compression – Default compression method. Default is no compression.
  • auto_declare – Automatically declare the exchange at instantiation. Default is True.
  • on_return – Callback to call for undeliverable messages, when the mandatory or immediate arguments to publish() is used. This callback needs the following signature: (exception, exchange, routing_key, message). Note that the producer needs to drain events to use this feature.
close()
declare()

Declare the exchange.

This is done automatically at instantiation if auto_declare is set to True.

publish(body, routing_key=None, delivery_mode=None, mandatory=False, immediate=False, priority=0, content_type=None, content_encoding=None, serializer=None, headers=None, compression=None, exchange=None, **properties)

Publish message to the specified exchange.

Parameters:
  • body – Message body.
  • routing_key – Message routing key.
  • delivery_mode – See delivery_mode.
  • mandatory – Currently not supported.
  • immediate – Currently not supported.
  • priority – Message priority. A number between 0 and 9.
  • content_type – Content type. Default is autodetect.
  • content_encoding – Content encoding. Default is autodetect.
  • serializer – Serializer to use. Default is autodetect.
  • headers – Mapping of arbitrary headers to pass along with the message body.
  • exchange – Override the exchange. Note that this exchange must have been declared.
  • properties – Additional properties, see the AMQP spec.
release()
revive(channel)

Revive the producer after connection loss.

ProducerPool.create_producer()
ProducerPool.new()
ProducerPool.prepare(p)
ProducerPool.release(resource)
ProducerPool.setup()
kombu.pools.set_limit(limit)
kombu.pools.reset()

Previous topic

kombu.compression

Next topic

kombu.compression

This Page