¡@

Home 

OpenStack Study: rpc_notifier2.py

OpenStack Index

**** CubicPower OpenStack Study ****

def notify(context, message):

    """Sends a notification via RPC."""

    if not context:

        context = req_context.get_admin_context()

    priority = message.get('priority',

                           CONF.default_notification_level)

    priority = priority.lower()

    for topic in CONF.rpc_notifier2.topics:

        topic = '%s.%s' % (topic, priority)

        try:

            rpc.notify(context, topic, message, envelope=True)

        except Exception:

            LOG.exception(_("Could not send notification to %(topic)s. "

                            "Payload=%(message)s"), locals())