Running StreamBase Server as a Windows Service

This topic describes the Windows service entries installed by StreamBase on Windows, and discusses how to activate those services. The topic also discusses how to add your own Windows service entries with alternate service names, which lets you run multiple Windows services on the same machine.

StreamBase Service As Installed

A Windows service is an executable that can be set to run automatically when Windows is booted, and to remain running as a background process.

The StreamBase installer adds entries to the Windows registry, as described in StreamBase Registry Keys on Windows, that set up one or more Windows services.

The installed services are set for Manual startup, which means they do not start by default. This lets the StreamBase service setup remain in place for activation as needed.

A default-installed Windows service has the following characteristics:

  • It is set to run sbd –b, which runs StreamBase Server in background mode. See Server Background Mode and Logging for information on the effects of the –b option.

  • No application or containers are specified. Only the base server is started.

  • The service is set to run on the default TCP port, 10000.

Activating the Installed StreamBase Service

When activating and using a default-installed StreamBase service, you can either:

  • Start the base service as installed, then connect to it with sbadmin addContainer to add and configure the application to run.

  • Configure a registry setting to specify the exact container and application configuration you want to run as a service.

Configure the default service by editing one or more registry keys described in StreamBase Registry Keys on Windows. The simplest and recommended configuration is to edit the sbd64.n.mStartup key to change its value from the default –b to –b c:\absolute\path\to\appname.sbdeploy, specifying the absolute path to a StreamBase Server deployment file. In the deployment file, specify the containers and applications to load, the port number to listen on, the location of any resource files required, and other details.

For an uncomplicated application running in the default container with no other containers required, replace the -b with -f followed by the absolute path to the StreamBase configuration file for your project. For example: -b -f C:\Users\sbuser\project\sbd.sbconf

You can also specify both configuration and deployment files for projects that require both:

-b -f C:\Users\sbuser\project\sbd.sbconf C:\Users\sbuser\project\appname.sbdeploy

To activate a default-installed StreamBase service so that it starts at Windows boot time:

  1. Open the Windows Services control panel, as shown in the example below.

  2. Locate the StreamBase n.m Service entry. Notice that there is one such entry for each StreamBase release you have installed on this machine. Be sure to select the entry for the release you want to run.

  3. To start a service one time for testing, right-click the line and select Start.

  1. To start the service every time Windows boots, follow these steps:

    1. Double-click the entry. This opens the Properties dialog, like the example below.

    2. In the Startup type drop-down list, select Automatic.

    3. Click OK.

Setting Up Multiple StreamBase Services

StreamBase lets you run more than one instance of StreamBase Server on the same Windows machine. Each application is hosted by its own sbd process. To run more than one application as a Windows service, create additional StreamBase services with different service names to host the applications.

Follow these steps:

  1. Open a StreamBase Command Prompt.

    Notes

    • On 64-bit Windows, to configure the 64-bit StreamBase Server as a service, you must open the StreamBase 64-bit Command Prompt.

    • On Windows 7 or later, you must open the StreamBase Command Prompt with the Run as administrator option. Otherwise, the sbd --install-service command fails silently or returns sbd64-ours failed to install, depending on your Windows version. For instructions, see Running As Administrator on Windows 7 and 8.

  2. From a Administrator-privileged StreamBase 64-bit Command Prompt, run sbd with its --install-service and --service-name options. For example:

    sbd --install-service --service-name "sbd64-ours,StreamBase 7.5 Alternate 64-bit Service"

    If successful, StreamBase displays a confirmation message like the following:

    sbd64-ours installed with display name "StreamBase 7.5 Alternate 64-bit Service"

    Note

    The first argument in the --service-name option is used as a prefix in several Windows registry keys. The second argument, the service name, is used as shown below in the alphabetical display of Windows services in the control panel. We recommend that you start the display name with "StreamBase" to make it easier to locate both default and customized StreamBase services in the same place in the Services control panel.

  3. Open the Services control panel and look for the display name of the service just added. For example:

  4. Start regedit or another registry editor. Navigate to the location described in StreamBase Registry Keys on Windows and locate the startup entry for the newly added service. For this example, we added a service named sbd64-ours, so we should find a new registry key named sbd64-oursStartup:

  5. Double-click the newly added startup key. In the resulting dialog, add the full path to the StreamBase deployment file that describes the StreamBase application you want to run:

    You can also specify -f and the full path to a StreamBase configuration file, or both configuration and deployment files, as described at the start of this section, above.

  6. Click OK. The registry editor now shows:

  7. Close the registry editor.

  8. Back in the Services Control Panel, locate the newly added service. Double-click its name, and set the Startup type to Automatic.

If you intend to use StreamBase authentication with your alternate service name, create a sub-key with the same name as the alternate service. Use this sub-key as the place to install the sbWindowsServiceUserName and sbWindowsServicePassword keys used by the authentication service. For example, for the service name sbd64-ours, create a sub-key named sbd64-ours. See Placeholder Sub-Keys for details.

Removing StreamBase Services

If you need to remove a StreamBase service, use the --remove-service option on the sbd command line. To identify the service to remove, use only the first argument you gave with the --install-service option. For example:

sbd --remove-service --service-name sbd64-ours

The StreamBase uninstaller does not know about any manual edits you made to the StreamBase registry keys. Consequently, the StreamBase uninstaller does not remove any manually added StreamBase service entries. Under these circumstances, use regedit to search for and remove any obsolete keys.

Notes

  • On 64-bit Windows, to remove the 64-bit StreamBase Server as a service, be sure to run the sbd --remove-service command from the StreamBase 64-bit Command Prompt.

  • On Windows 7 or later, you must open the StreamBase Command Prompt with the Run as administrator option. Otherwise, the sbd --install-service command fails silently or returns sbd64-ours failed to install, depending on your Windows version. For instructions, see Running As Administrator on Windows 7 and 8.

Back to top