Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 13 TIBCO Wrapper Utility : Running an Adapter as a Microsoft Windows Service

Running an Adapter as a Microsoft Windows Service
This section explains how to run an adapter as a Microsoft Windows service.
Java Adapters
To run a Java adapter as a service under Microsoft Windows:
1.
2.
Rename the wrap.exe or gwrap.exe binary to the name of your application (for example, SimpleApp.exe).
3.
Name the properties file app_name.tra (for example, SimpleApp.tra). It will be picked up automatically when one of the TIBCO Wrapper command-line options is used. You can also specify which properties file to use through the --propFile filename command-line option.
4.
   SimpleApp.exe --install
5.
using the --start command line option
Upon reboot, you don’t have to restart automatic services explicitly.
The application is now running in the background as a service.
If you changed details in the properties file, run --uninstall and --install again. Otherwise, changes do not take effect.
Note that the properties file itself is not read when the application is running as a Windows Service.
 
C++ Adapters
Use the TIBCO Wrapper with the C++ application in two ways:
Explicitly Linking the Library—This produces an executable that can be run from the command line.
Delayed Application Shared Library Loading—At times, it is necessary to set a per-application PATH instead of accepting a system setting. The PATH environment variable dictates which dependent shared libraries are loaded.
This approach produces a shared library that can then be loaded by the Wrapper executable, and allows you to do this.
Explicitly Linking the Library
To run a C++ adapter as a service on Microsoft Windows platforms:
1.
Rename the current main() to AppMain().
2.
Write an AppStop() method, if required.
3.
Write a new main() that calls the LaunchWrapper() function.
4.
Modify the existing adapter code to call the SetServiceState() function as appropriate for the adapter.
5.
Compile and link with the libwrap.lib static library.
6.
If you named the properties file app_name.tra (for example, SimpleApp.tra), it is picked up automatically. You can also specify which properties file to use through a command-line option.
7.
 
   SimpleApp.exe --install
8.
using the --start command line option
Upon reboot, automatic services are restarted.
The application is now running in the background as a service.
If you changed details in the properties file, run --uninstall and --install again. Otherwise, changes do not take effect.
Note that the properties file itself is not read when the application is running as a Windows service.
Delayed Application Shared Library Loading
To run a C++ adapter as a service on Microsoft Windows platforms, and change the loading of dependent shared libraries to allow the wrapper to modify the PATH environment variable:
1.
2.
Rename the current main() to AppMain().
3.
Write an AppStop() method, if required.
4.
Write a RegisterWrapperEntryPoints() function. This function gives you a function callback pointer for setting the service state.
5.
Write a SetServiceState() function, as appropriate for the adapter, that uses the pointer obtained from RegisterWrapperEntryPoints().
6.
Create a properties file detailing Service properties. Be sure to set the application.library property to point to the application shared library.
If you named the properties file app_name.tra (for example, SimpleApp.tra), it is picked up automatically. You can also specify which properties file to use through a command-line option.
7.
Rename the wrap.exe or gwrap.exe binary to the name of the application (for example, SimpleApp.exe).
8.
 
   SimpleApp.exe --install
9.
using the --start command line option
Upon reboot, automatic services are restarted.
The application is now running in the background as a service.
If you changed details in the properties file, run --uninstall and --install again. Otherwise, changes do not take effect.
Note that the properties file itself is not read when the application is running as a Windows service.

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved