Server Guide


Making your application into an NT service

To turn your server application into an NT service, first ensure that your image holds the IBM ST: Server Workbench, Base feature and the application you want to deploy as an NT 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 VisualAge 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 application's processing in an orderly manner. When this method returns, VisualAge 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 VisualAge Smalltalk User's 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 NT 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 an NT service, refer to the VisualAge Smalltalk User's Guide.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]