Transport

oslo.messaging.get_transport(conf, url=None, allowed_remote_exmods=[], aliases=None)

A factory method for Transport objects.

This method will construct a Transport object from transport configuration gleaned from the user’s configuration and, optionally, a transport URL.

If a transport URL is supplied as a parameter, any transport configuration contained in it takes precedence. If no transport URL is supplied, but there is a transport URL supplied in the user’s configuration then that URL will take the place of the URL parameter. In both cases, any configuration not supplied in the transport URL may be taken from individual configuration parameters in the user’s configuration.

An example transport URL might be:

rabbit://me:passwd@host:5672/virtual_host

and can either be passed as a string or a TransportURL object.

Parameters:
  • conf (cfg.ConfigOpts) – the user configuration
  • url (str or TransportURL) – a transport URL
  • allowed_remote_exmods (list) – a list of modules which a client using this transport will deserialize remote exceptions from
  • aliases (dict) – A map of transport alias to transport name
class oslo.messaging.Transport(driver)

A messaging transport.

This is a mostly opaque handle for an underlying messaging transport driver.

It has a single ‘conf’ property which is the cfg.ConfigOpts instance used to construct the transport object.

class oslo.messaging.TransportURL(conf, transport=None, virtual_host=None, hosts=None, aliases=None)

A parsed transport URL.

Transport URLs take the form:

transport://user:pass@host1:port[,hostN:portN]/virtual_host

i.e. the scheme selects the transport driver, you may include multiple hosts in netloc and the path part is a “virtual host” partition path.

Parameters:
  • conf (oslo.config.cfg.ConfigOpts) – a ConfigOpts instance
  • transport (str) – a transport name e.g. ‘rabbit’ or ‘qpid’
  • virtual_host (str) – a virtual host path e.g. ‘/’
  • hosts (list) – a list of TransportHost objects
  • aliases (dict) – A map of transport alias to transport name
classmethod parse(conf, url, aliases=None)

Parse an url.

Assuming a URL takes the form of:

transport://user:pass@host1:port[,hostN:portN]/virtual_host

then parse the URL and return a TransportURL object.

Netloc is parsed following the sequence bellow:

  • It is first split by ‘,’ in order to support multiple hosts

  • The last parsed username and password will be propagated to the rest of hosts specified:

    user:passwd@host1:port1,host2:port2

    [

    {“username”: “user”, “password”: “passwd”, “host”: “host1:port1”}, {“username”: “user”, “password”: “passwd”, “host”: “host2:port2”}

    ]

  • In order to avoid the above propagation, it is possible to alter the order in which the hosts are specified or specify a set of fake credentials using ”,:@host2:port2”

    user:passwd@host1:port1,:@host2:port2

    [

    {“username”: “user”, “password”: “passwd”, “host”: “host1:port1”}, {“username”: “”, “password”: “”, “host”: “host2:port2”}

    ]

Parameters:
  • conf (oslo.config.cfg.ConfigOpts) – a ConfigOpts instance
  • url (str) – The URL to parse
  • aliases (dict) – A map of transport alias to transport name
Returns:

A TransportURL

class oslo.messaging.TransportHost(hostname=None, port=None, username=None, password=None)

A host element of a parsed transport URL.

oslo.messaging.set_transport_defaults(control_exchange)

Set defaults for messaging transport configuration options.

Parameters:control_exchange (str) – the default exchange under which topics are scoped

Previous topic

oslo.messaging

Next topic

Target

This Page