[Twisted-Python] XML-RPC Server in multiservice application
itamar at itamarst.org
Sun Nov 27 08:35:16 EST 2011
On 11/27/2011 06:58 AM, Don Schoeman wrote:
> I've got a multiservice application running and I'm using the
> MultiService class from twisted.application.service to do this. All my
> existing services are setup as children of my multiservice instance.
> In addition I'd like to run an XML/RPC server as as well. Is it ok if I
> instantiate the XML/RPC listening server as per the examples?
> r = MyXMLRPCServer()
> reactor.listenTCP(7080, server.Site(r))
> I've tried this and it does seem to peacefully co-exist alongside the
> other services, but is this the correct way of implementing the XML/RPC
> server on a multiservice application?
A more consistent way, though, would be to have a subclass of Service
hooked up to your multiservice. This service's startService method would
do the above, and stopService would do port.stopListening() on the port
returned from listenTCP.
More information about the Twisted-Python