Chapter 2. Installation

This chapter guides you through the steps required to install AMQ JavaScript in your environment.

2.1. Prerequisites

To begin installation, use your subscription to access AMQ distribution archives and package repositories.

To use AMQ JavaScript, you must also install and configure Node.js for your environment. See the Node.js website for more information.

AMQ JavaScript depends on the Node.js debug module. See the npm page for installation instructions.

2.2. Installing on Red Hat Enterprise Linux

AMQ JavaScript is distributed as a zip archive. Follow these steps to install it in your environment.

  1. Open a browser and log in to the Red Hat Customer Portal at access.redhat.com.
  2. Navigate to DOWNLOADS.
  3. Locate the Red Hat JBoss AMQ entry in the JBOSS INTEGRATION AND AUTOMATION category.
  4. Select Download Latest Client from the drop-down menu on the right side of the entry.
  5. Download the AMQ JavaScript Client zip file.
  6. Use the unzip command to extract the file contents into a directory of your choosing. This will create a new subdirectory called nodejs-rhea-VERSION.

    $ unzip nodejs-rhea-VERSION.zip
    Archive:  nodejs-rhea-VERSION.zip
       creating: nodejs-rhea-VERSION/
       creating: nodejs-rhea-VERSION/node_modules/
       creating: nodejs-rhea-VERSION/node_modules/rhea/
    [...]
  7. Configure your environment to use the installed library. Add the node_modules directory to the NODE_PATH environment variable.

    $ cd nodejs-rhea-VERSION
    $ export NODE_PATH=$PWD/node_modules:$NODE_PATH

    To make this configuration take effect for all new console sessions, set NODE_PATH in your $HOME/.bashrc file.

  8. Test your installation. The following command will return zero if it can successfully import the installed library.

    $ node -e 'require("rhea")'; echo $?
    0

2.3. Installing on Microsoft Windows

  1. Open a browser and log in to the Red Hat Customer Portal at access.redhat.com.
  2. Navigate to DOWNLOADS.
  3. Locate the Red Hat JBoss AMQ entry in the JBOSS INTEGRATION AND AUTOMATION category.
  4. Select Download Latest Client from the drop-down menu on the right side of the entry.
  5. Download the AMQ JavaScript Client zip file.
  6. Extract the file contents into a directory of your choosing by right-clicking on the zip file and selecting Extract All. This will create a new subdirectory called nodejs-rhea-VERSION.
  7. Configure your environment to use the installed library. Add the node_modules directory to the NODE_PATH environment variable.

    $ cd nodejs-rhea-VERSION
    $ set NODE_PATH=%cd%\node_modules;%NODE_PATH%

2.4. Preparing the Library for Use in Browsers

AMQ JavaScript can run inside a web browser. To create a browser-compatible version of the library, use the npm run browserify command.

$ cd nodejs-rhea-VERSION/node_modules/rhea
$ npm install
$ npm run browserify

This will produce a file called rhea.js that can be used in browser-based applications.