Base class for transports

A base class you should extend when writing transports.


class vumi.transports.base.TransportConfig(config_data, static=False)

Base config definition for transports.

You should subclass this and add transport-specific fields.

Configuration options:

  • amqp_prefetch_count (int) – The number of messages fetched concurrently from each AMQP queue by each worker instance.
  • transport_name (str) – The name this transport instance will use to create its queues.
  • publish_status (bool) – Whether status messages should be published by the transport
class vumi.transports.base.Transport(options, config=None)

Base class for transport workers.

The following attributes are available for subclasses to control behaviour:

  • start_message_consumer – Set to False if the message consumer should not be started. The subclass is responsible for starting it in this case.

alias of TransportConfig

static generate_message_id()

Generate a message id.


This must be overridden to read outbound messages and do the right thing with them.

publish_ack(user_message_id, sent_message_id, **kw)

Helper method for publishing an ack event.

publish_delivery_report(user_message_id, delivery_status, **kw)

Helper method for publishing a delivery_report event.


Publish a TransportEvent message.

Some default parameters are handled, so subclasses don’t have to provide a lot of boilerplate.


Publish a TransportUserMessage message.

Some default parameters are handled, so subclasses don’t have to provide a lot of boilerplate.

publish_nack(user_message_id, reason, **kw)

Helper method for publishing a nack event.


Helper method for publishing a status message.

send_failure(message, exception, traceback)

Send a failure report.


All transport_specific setup should happen in here.

Subclasses should override this method to perform extra setup.


Set up basic transport worker stuff.

You shouldn’t have to override this in subclasses.


Clean-up of setup done in setup_transport should happen here.