Chapter 2. Installing a Broker as a Windows Service
Abstract
In this tutorial you will install a Red Hat JBoss A-MQ instance as a Windows service.
Goals
In this tutorial you will:
- generate the service wrapper
- configure the Java Wrapper Service for your system
- install a broker instance as a Windows service
- configure the broker's service to start up automatically
Prerequisites
This tutorial requires that you have Red Hat JBoss A-MQ installed on a Windows computer to which you have administrative privileges.
Procedure
To install JBoss A-MQ as a Windows service:
- Start JBoss A-MQ in console mode using the amq command.
- Once the console is started and the command prompt appears, enter
features:install wrapper
.The features:install command will locate the required libraries to provision the wrapper feature and deploy it into the run time. - Generate the wrapper by entering
wrapper:install -n JBossMQ -d JBossMQ -D "JBossMQ Broker"
.You should see the output shown in Example 2.1, “Wrapper Install Output”.Example 2.1. Wrapper Install Output
Creating file: InstallDir\bin\FuseMQ-wrapper.exe Creating file: InstallDir\bin\JBossMQ-service.bat Creating file: InstallDir\etc\JBossMQ-wrapper.conf Creating file: InstallDir\lib\libwrapper.so Creating file: InstallDir\lib\karaf-wrapper.jar Creating file: InstallDir\lib\karaf-wrapper-main.jar Setup complete. You may wish to tweak the JVM properties in the wrapper config ration file: InstallDir\etc\JBossMQ-wrapper.conf before installing and starting the service. To install the service, run: C:> InstallDir\bin\JBossMQ-service.bat install Once installed, to start the service run: C:> net start "JBossMQ" Once running, to stop the service run: C:> net stop "JBossMQ" Once stopped, to remove the installed the service run: C:> InstallDir\bin\karaf-service.bat remove
- Open
InstallDir\etc\JBossMQ-wrapper.conf
in a text editor.TheServiceName-wrapper.conf
file configures the Java Wrapper Service that JBoss A-MQ uses to create a Windows service. - Change the line containing
set.default.KARAF_HOME=
toset.default.KARAF_HOME=InstallDir
This tells the wrapper where the JBoss A-MQ installation is located so it can find the required libraries. - Change the line containing
set.default.KARAF_BASE
toset.default.KARAF_BASE=InstallDir
This tells the wrapper where to find the configuration and data files for the broker instance being used for the service. - Change the line containing
set.default.KARAF_DATA
toset.default.KARAF_BASE=InstallDir\data
This tells the wrapper where to find the configuration and data files for the broker instance being used for the service. - Save the file.
- Open a command prompt.
- Change to the
InstallDir
directory. - Install the broker as a Windows service by running
bin\JBossMQ-service.bat install
. - From the Windowsmenu select
. The Services window opens. - Double click JBossMQ from the list of services.The JBossMQ Properties window opens.
- Specify that the service will start up when you login by selecting Automatic from the Startup Type drop-down list.
- Click.
- Open the context menu for theentry in the service list.
- Selectto start the broker.
Further steps
You can stop the broker service by selecting Service window's context menu.
in the
To uninstall the broker as a Windows service use
InstallDir\bin\JBossMQ-service.bat remove
s.