Installing SwiftMQ HA Router as a Windows Service

Introduction

SwiftMQ HA Router 7.4.0 onwards contains "JavaSerice.exe" and "installService.bat" as part of the Windows distribution. Both files are located within the "scripts/win32" directory. "JavaService.exe" works fine with Sun's JVMs, however, it doesn't seems to work with IBM JVMs.

Preparations

The "installService.bat" uses the following environment variables and values. If you use different values, you must edit "installService.bat".

Environment Variable Meaning Default Value
JAVA_HOME JDK Home Directory Not set
SWIFTMQ_SERVICENAME Name of the SwiftMQ Service SwiftMQ
HA_INSTANCE Name of HA instance. Must be instance1 or instance2 instance1
STORE_TYPE Type of the store. Must be replicated, shared or jdbc replicated
SWIFTMQ_WD Working Directory Current directory (%CD%)
SWIFTMQ_JARS JAR Files of the SwiftMQ router All JAR files in ../../jars
SWIFTMQ_CONFIG_FILE The router's configuration file. ../../config/%STORE_TYPE%/%HA_INSTANCE%/routerconfig.xml
STDOUT Service 'stdout' ../../log/%HA_INSTANCE%/service-stdout.log
STDERR Service 'stderr' ../../log/%HA_INSTANCE%/service-stderr.log

Installation / Removal

To install SwiftMQ as a service, change into the "scripts/win32" directory and type:

      installService install

The service is not started per default. To start it automatically you must change the startup mode of the service via the Control Panel.

To remove an installed SwiftMQ service type:

      installService remove

Stopping a running SwiftMQ Service

The service is stopped by killing the JVM. Because SwiftMQ HA Router has normally 2 HA instances running, hard killing one instance just leads to a failover. However, if the instance running as a Windows Service is in state STANDALONE, it must not be hard killed. Instead connect with SwiftMQ Explorer / CLI and perform an orderly shutdown. Then stop the service.