Using qilaunch ¶
qilaunch is a small executable that takes care of all the boilerplate when creating a service or when running an program with a session.
qilaunch takes care of:
- initializing an Application
- connecting a Session
- forwarding logs to the LogManager
- setting a breakpad handler for possible crashes
Then it loads one or more module as requested by the user. It can instantiate an object through a factory and register it as a service, or call a simple function and keep running.
Detailed description ¶
You need to provide a name when starting qilaunch. This name is used when qilaunch forwards the logs to the LogManager by prepending it to the category. In case of crash, it is also prepended to the minidump file name.
qilaunch loads services that are exposed as factories in modules. It can also
call functions exposed by modules. Factories are called through
and functions are called through
. Thus factories (usually class constructors) and
functions will receive the session as first parameter if they accept it.
All services are loaded first, in order, and then all functions are called, concurrently.
If a factory or a function throws, everything is aborted and qilaunch exits with an error.
On success (when all factories and functions finished successfully), if qilaunch
is started in
mode (which is implied by
), it will
keep running until
is called or until it receives a
termination signal. Otherwise, it will stop at the end of the function(s) given
qilaunch also supports all qi application arguments .
Example usage ¶
qilaunch --name mymodule --object MyModule.MyService --qi-url tcp://myhost:9559
This will connect to myhost:9559, load MyModule, instantiate MyService through the factory of the same name and register it on the service directory.
qilaunch --name mylauncher --function MyModule.workIt
This will connect to localhost:9559, load MyModule and call workIt on it. It will terminate as soon as workIt returns.
qilaunch --name mylauncher --function MyModule.workIt --module MyModule.MyService --no-logging --qi-standalone
This will first start a Session in standalone mode (with a ServiceDirectory). It will not forward logs to the LogManager. It will first load MyModule and instantiate MyService and then call workIt.