Making your application into a Windows Service
To turn your server application into a Windows Service, first ensure that your image holds the ST: Server Workbench, Base feature and the application you want to deploy as a Windows Service. With the feature and your application loaded, complete the following steps:
1. Open a browser on your application and implement two methods.
The first method, which goes in your application class, provides an entry point into the application. This method should complete the start up of your service application by immediately sending the following message:
AbtNtServiceInterface default registerService: aClassName stopSelector: aSelector
aClassName is the class that implements aSelector. This selector's method will be invoked when the Windows NT Service Control Manager sends a SERVICE_STOP message to the service. A sample VA Smalltalk NT service application provided with the Server Workbench feature, AbtNtServiceExampleApp, sends the following method:
AbtNtServiceInterface default registerService: self name stopSelector: #stopping.
Registering the stop selector also tells the SCM that the service has started. Failure to send the message immediately may result in an error in starting the service as the SCM might time out waiting for notification that the service has started.
The second method, a class method aSelector in the class aClassName, should stop your VA Smalltalk application's processing in an orderly manner. When this method returns, VA Smalltalk will exit with a return code of 0.
2. Ensure that your application names AbtNtServiceSupportApp as a prerequisite. Also ensure that your application does not name AbtViewApplication as a prerequisite. Because your service application must be headless, you do not need AbtViewApplication, which supports visual parts.
3. Package your application using the XD packager. That is, create a Windows NT Target passive image, load your application into the passive image, and package your application. You must assign your packaged image the same name you'll be using for the NT service. See Packaging a Smalltalk image. For more information on adding your application to Windows NT Services, see Visual Programming User Guide.
4. Test your application to make sure it runs as desired.
 
tips
If you do not have an application that would be appropriate for a service, load the applications AbtNtServiceSupportApp and AbtNtServiceExampleApp, then complete these steps. For packaging, load AbtNtServiceExampleApp into a Windows Target passive image, and package it using the image type XD Single Image, the image startup class AbtHeadlessRuntimeStartUp, the application entry point AbtNtServiceExampleApp starting, and the image name ntservex.icx.
For more information about installing your application as a Windows Service, refer to the Visual Programming User Guide.
Last modified date: 07/24/2020