Skip to content

Instantly share code, notes, and snippets.

@markmc
Created Dec 6, 2013
Embed
What would you like to do?
Sample oslo.messaging server which doesn't use config files
import eventlet
eventlet.monkey_patch(os=False)
import logging
from oslo.config import cfg
from oslo import messaging
logging.basicConfig(level=logging.DEBUG)
class Server(object):
def __init__(self, transport):
self.target = messaging.Target(topic='topic', server='foo')
self._server = messaging.get_rpc_server(transport,
self.target,
[self],
executor='eventlet')
super(Server, self).__init__()
def start(self):
self._server.start()
def wait(self):
self._server.wait()
def ping(self, ctxt):
return 'ping'
transport = messaging.get_transport(cfg.ConfigOpts(), 'qpid:///test')
server = Server(transport)
server.start()
server.wait()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment