Notifier

class oslo.messaging.Notifier(transport, publisher_id, driver=None, topic=None, serializer=None)

Send notification messages.

The Notifier class is used for sending notification messages over a messaging transport or other means.

Notification messages follow the following format:

{‘message_id’: str(uuid.uuid4()),
‘publisher_id’: ‘compute.host1’, ‘timestamp’: timeutils.utcnow(), ‘priority’: ‘WARN’, ‘event_type’: ‘compute.create_instance’, ‘payload’: {‘instance_id’: 12, ... }}

A Notifier object can be instantiated with a transport object and a publisher ID:

notifier = notifier.Notifier(get_transport(CONF), ‘compute.host1’)

and notifications are sent via drivers chosen with the notification_driver config option and on the topics consen with the notification_topics config option.

Alternatively, a Notifier object can be instantiated with a specific driver or topic:

notifier = notifier.Notifier(RPC_TRANSPORT,
‘compute.host’, driver=’messaging’, topic=’notifications’)
critical(ctxt, event_type, payload)

Send a notification at critical level.

Parameters:
  • ctxt (dict) – a request context dict
  • event_type (str) – describes the event, e.g. ‘compute.create_instance’
  • payload (dict) – the notification payload
debug(ctxt, event_type, payload)

Send a notification at debug level.

Parameters:
  • ctxt (dict) – a request context dict
  • event_type (str) – describes the event, e.g. ‘compute.create_instance’
  • payload (dict) – the notification payload
error(ctxt, event_type, payload)

Send a notification at error level.

Parameters:
  • ctxt (dict) – a request context dict
  • event_type (str) – describes the event, e.g. ‘compute.create_instance’
  • payload (dict) – the notification payload
info(ctxt, event_type, payload)

Send a notification at info level.

Parameters:
  • ctxt (dict) – a request context dict
  • event_type (str) – describes the event, e.g. ‘compute.create_instance’
  • payload (dict) – the notification payload
warn(ctxt, event_type, payload)

Send a notification at warning level.

Parameters:
  • ctxt (dict) – a request context dict
  • event_type (str) – describes the event, e.g. ‘compute.create_instance’
  • payload (dict) – the notification payload

Previous topic

RPC Client

Next topic

Serializer

This Page