Example #1
0
 def makeService(self, options):
     cookie = options["cookie"]
     if not cookie:
         cookie = readCookie()
     nodeName = buildNodeName(options["nodename"])
     process = Process(nodeName, cookie)
     rservice = RabbitMQControlService(process)
     site = server.Site(resource.IResource(rservice))
     srvc = internet.TCPServer(int(options["port"]), site)
     return srvc
Example #2
0
 def makeService(self, options):
     cookie = options['cookie']
     if not cookie:
         cookie = readCookie()
     methodsHolder = options.get('methods', {})
     if methodsHolder:
         methodsHolder = namedAny(methodsHolder)
     nodeName = buildNodeName(options['nodename'])
     epmd = PersistentPortMapperService(methodsHolder, nodeName, cookie)
     return epmd
Example #3
0
def main(nodeName, server=False):
    cookie = readCookie()
    nodeName = buildNodeName(nodeName)
    process = Process(nodeName, cookie)
    process.registerModule("api", RemoteCalls(process))
    if server:
        process.listen().addCallback(lambda x: testReceive(process))
    else:
        testPing(process)
    reactor.run()
Example #4
0
def make_rabbitmqctl_service():
    """
    Boiler plate construction of txrabbitmq Service.
    Usually Twisted Service libraries provide a makeService method.
    """
    from twotp import Process, readCookie, buildNodeName
    cookie = readCookie()
    nodeName = buildNodeName('txrabbitmq')
    process = Process(nodeName, cookie)
    service = RabbitMQControlService(process, 'rabbit')
    return service
Example #5
0
# Copyright (c) 2007-2009 Thomas Herve <*****@*****.**>.
# See LICENSE for details.

"""
Example emulating rabbitmqctl, just calling list_vhosts for now.
"""

from twisted.internet import reactor

from twotp import Process, readCookie, buildNodeName


def testListVhost(process):
    def cb(resp):
        print resp
        reactor.stop()
    def eb(error):
        print "Got error", error
        reactor.stop()
    process.callRemote("rabbit", "rabbit_access_control", "list_vhosts"
        ).addCallback(cb).addErrback(eb)


if __name__ == "__main__":
    cookie = readCookie()
    nodeName = buildNodeName("twotp-rabbit")
    process = Process(nodeName, cookie)
    reactor.callWhenRunning(testListVhost, process)
    reactor.run()
Example #6
0
def main():
    cookie = readCookie()
    nodeName = buildNodeName('nodename')
    process = Process(nodeName, cookie)
    manager = MnesiaManager(process)