Notification Driver

Notification drivers for sending notifications via messaging.

The messaging drivers publish notification messages to notification listeners.

In case of the rabbit backend the driver will block the notifier’s thread until the notification message has been passed to the messaging transport. There is no guarantee that the notification message will be consumed by a notification listener.

In case of the kafka backend the driver will not block the notifier’s thread but return immediately. The driver will try to deliver the message in the background.

Notification messages are sent ‘at-most-once’ - ensuring that they are not duplicated.

If the connection to the messaging service is not active when a notification is sent the rabbit backend will block waiting for the connection to complete. If the connection fails to complete, the driver will try to re-establish that connection. By default this will continue indefinitely until the connection completes. However, the retry parameter can be used to have the notification send fail. In this case an error is logged and the notifier’s thread is resumed without any error.

If the connection to the messaging service is not active when a notification is sent the kafka backend will return immediately and the backend tries to establish the connection and deliver the messages in the background.

class oslo_messaging.notify.messaging.MessagingDriver(conf, topics, transport, version=1.0)

Send notifications using the 1.0 message format.

This driver sends notifications over the configured messaging transport, but without any message envelope (also known as message format 1.0).

This driver should only be used in cases where there are existing consumers deployed which do not support the 2.0 message format.

class oslo_messaging.notify.messaging.MessagingV2Driver(conf, **kwargs)

Send notifications using the 2.0 message format.

class oslo_messaging.notify.notifier.Driver(conf, topics, transport)

Base driver for Notifications

abstract notify(ctxt, msg, priority, retry)

send a single notification with a specific priority

Parameters:
  • ctxt – current request context

  • msg (str) – message to be sent

  • priority (str) – priority of the message

  • retry (int) – connection retries configuration (used by the messaging driver): None or -1 means to retry forever. 0 means no retry is attempted. N means attempt at most N retries.