[Twisted-Python] Plugin startup and shutdown actions

Jean-Paul Calderone exarkun at divmod.com
Sat Apr 11 09:20:25 MDT 2009


On Sat, 11 Apr 2009 00:24:37 +0200, luper rouch <luper.rouch at gmail.com> wrote:
>I would like to port my Application API based services to the twistd
>plugin interface, to be able to retrieve command line options.
>
>In the existing services, I reimplemented t.a.s.MultiService
>startService() and stopService() to do some actions at startup and
>shutdown.
>
>How can I do this in a plugin ?
>

The top-level API for plugins is mostly a function that returns an IService
provider.  So if you have your own version of MultiService, you can just
return an instance of that, just like the one you were creating in your .tac
file, from a makeService function which is registered as a plugin of the
suitable type.

Jean-Paul




More information about the Twisted-Python mailing list