Created
October 16, 2016 21:56
-
-
Save openstacker/7a62799ade0523198da8ee90ba2c6a7b to your computer and use it in GitHub Desktop.
oslo_messaging producer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
from oslo_config import cfg | |
import oslo_messaging | |
import logging | |
logging.basicConfig() | |
log = logging.getLogger() | |
log.addHandler(logging.StreamHandler()) | |
log.setLevel(logging.INFO) | |
transport_url = 'rabbit://stackrabbit:[email protected]:5672/' | |
transport = oslo_messaging.get_transport(cfg.CONF, transport_url) | |
driver = 'messaging' | |
notifier = oslo_messaging.Notifier(transport, driver=driver, publisher_id='fake_publisher', topic='alarm.all') | |
notifier.info({'some': 'context'}, 'just.testing', {'heavy': 'payload'}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment