Class ServiceApp() Foundation
Class function of the ServiceApp class
The ServiceApp class is used to implement Service applications on Windows platforms capable of running services. For technical background information please refer to the section Implementing services.
The class is unique in the way that it consists only of the class object and no instances can be created. This reflects the situation that only one service can be implemented in a single executable file. Therefore, only one object is required per service application and there are only class methods and class variables belonging to the class object. As a result, the ServiceApp class does not have a :new() or :init() method.
There are two ways of implementing a service: using callback code blocks or callback methods. This concept is similar to the callback implementation of Xbase Parts where the reaction to a particular event is programmed by assigning a code block to an instance variable or by overloading the corresponding method in a derived class. In the ServiceApp class, the callbacks are used to implement the reaction to a particular Control request.
A minimum of two callbacks must be implemented that contain the code for the task of the service and how to stop it after being started. The callbacks are :main() and :stop(), both of which are member variables or methods of the class object.
These class methods are called from the system as a response to control requests from a service control application. It is the programmer's responsibility to implement the behaviour in response of these messages.
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.