class oslo_messaging.Transport(driver)

A messaging transport.

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

RPCs and Notifications may use separate messaging systems that utilize different drivers, access permissions, message delivery, etc. To ensure the correct messaging functionality, the corresponding method should be used to construct a Transport object from transport configuration gleaned from the user’s configuration and, optionally, a transport URL.

The factory method for RPC Transport objects:

def get_rpc_transport(conf, url=None,

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.

The factory method for Notification Transport objects:

def get_notification_transport(conf, url=None,

If no transport URL is provided, the URL in the notifications section of the config file will be used. If that URL is also absent, the same transport as specified in the user’s default section will be used.

The Transport 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, query=None)

A parsed transport URL.

Transport URLs take the form:




Specifies the transport driver to use. Typically this is rabbit for the RabbitMQ broker. See the documentation for other available transport drivers.


Specifies the network location of the broker. user and pass are the optional username and password used for authentication with the broker.

user and pass may contain any of the following ASCII characters:
  • Alphabetic (a-z and A-Z)

  • Numeric (0-9)

  • Special characters: & = $ - _ . + ! * ( )

user may include at most one @ character for compatibility with some implementations of SASL.

All other characters in user and pass must be encoded via ‘%nn’

You may include multiple different network locations separated by commas. The client will connect to any of the available locations and will automatically fail over to another should the connection fail.


Specifies the “virtual host” within the broker. Support for virtual hosts is specific to the message bus used.


Permits passing driver-specific options which override the corresponding values from the configuration file.

  • conf (oslo.config.cfg.ConfigOpts) – a ConfigOpts instance

  • transport (str) – a transport name for example ‘rabbit’

  • virtual_host (str) – a virtual host path for example ‘/’

  • hosts (list) – a list of TransportHost objects

  • query (dict) – a dictionary of URL query parameters

classmethod parse(conf, url=None)

Parse a URL as defined by TransportURL and return a TransportURL object.

Assuming a URL takes the form of:


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

  • All hosts should be specified with username/password or not at the same time. In case of lack of specification, username and password will be omitted:

      {"username": "user", "password": "pass", "host": "host1:port1"},
      {"host": "host2:port2"}

If the url is not provided conf.transport_url is parsed instead.

  • conf (oslo.config.cfg.ConfigOpts) – a ConfigOpts instance

  • url (str) – The URL to parse


A TransportURL

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

A host element of a parsed transport URL.


Set defaults for messaging transport configuration options.


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

Forking Processes and oslo.messaging Transport objects

oslo.messaging can’t ensure that forking a process that shares the same transport object is safe for the library consumer, because it relies on different 3rd party libraries that don’t ensure that. In certain cases, with some drivers, it does work:

  • rabbit: works only if no connection have already been established.

  • amqp1: works