User's Guide


Making your application into an NT service

To turn your server application into an NT service, first ensure that your image holds the AbtNtServiceSupportApp,AbtNtServicePackagingApp, 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 packager. You must assign your packaged image the same name you'll be using for the NT service. See Packaging your VisualAge application.
  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 application AbtNtServiceExampleApp, then complete these steps.
  1. From the System Transcript menu bar, select the Tools >Browse Packaged Images entry to open the Packager Control Panel.
  2. Click on the Instructions in Database tab and then double click the AbtNtServicePackagingApp entry to expose the AbtNtServiceImagePackagingInstructions selection.
  3. Select AbtNtServiceImagePackagingInstructions and proceed to Modify Instructions.
  4. Under Available Applications, select AbtNtServiceExampleApp and move it to Selected Applications and ICs.
  5. Click the Startup Code tab. Set the Image Startup Class to AbtNtServiceHeadlessRuntimeStartUp.
  6. Set Application Entry Point to AbtNtServiceExampleApp starting and Output File to ntservex.icx


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