baseplate.context.kombu

Configuration Parsing

baseplate.context.kombu.connection_from_config(app_config, prefix, **kwargs)

Make a Connection from a configuration dictionary.

The keys useful to connection_from_config() should be prefixed, e.g. amqp.hostname etc. The prefix argument specifies the prefix used to filter keys. Each key is mapped to a corresponding keyword argument on the Connection constructor. Any keyword arguments given to this function will be passed through to the Connection constructor. Keyword arguments take precedence over the configuration file.

Supported keys:

  • hostname
  • virtual_host
baseplate.context.kombu.exchange_from_config(app_config, prefix, **kwargs)

Make an Exchange from a configuration dictionary.

The keys useful to exchange_from_config() should be prefixed, e.g. amqp.exchange_name etc. The prefix argument specifies the prefix used to filter keys. Each key is mapped to a corresponding keyword argument on the Exchange constructor. Any keyword arguments given to this function will be passed through to the Exchange constructor. Keyword arguments take precedence over the configuration file.

Supported keys:

  • exchange_name
  • exchange_type

Classes

class baseplate.context.kombu.KombuProducerContextFactory(connection, exchange, max_connections=None)

KombuProducer context factory.

This factory will attach a proxy object which acts like a kombu.Producer to an attribute on the context object. The publish() method will automatically record diagnostic information.

Parameters:
  • connection (kombu.connection.Connection) – A configured connection object.
  • exchange (kombu.Exchange) – A configured exchange object
  • max_connections (int) – The maximum number of connections.
class baseplate.context.kombu.KombuProducer(name, span, connection, exchange, producers)
publish(body, routing_key=None, **kwargs)

Publish a message to the routing_key.

Parameters:
  • body (str) – The message body.
  • routing_key (str) – The routing key to publish to.

See Kombu Documentation for other arguments.