Ce contenu n'est pas disponible dans la langue sélectionnée.

Chapter 2. Installation


This chapter guides you through the steps to install Red Hat build of Rhea in your environment.

2.1. Prerequisites

  • You must have a subscription to access AMQ release files and repositories.
  • You must install the npm command line tool in your environment. See the npm website for more information.
  • To use Red Hat build of Rhea, you must install Node.js in your environment. See the Node.js website for more information.
  • Red Hat build of Rhea depends on the Node.js debug module. See the debug npm page for installation instructions.

2.2. Using the Red Hat NPM registry

Configure your NPM environment to download the client library from the Red Hat NPM registry.

Procedure

  1. Use the npm config set command to add the Red Hat NPM registry to your environment:

    $ sudo npm config set @redhat:registry https://npm.registry.redhat.com
    Copy to Clipboard Toggle word wrap
  2. Use the npm install command to install the client:

    $ sudo npm install -g @redhat/rhea@3.0.2-redhat-00001
    Copy to Clipboard Toggle word wrap
Note

The procedure above is for system-wide installations. You can run the commands without sudo and without the -g option to perform local installations.

To configure your environment to use the installed library, add the node_modules/@redhat directory to the NODE_PATH environment variable:

Red Hat Enterprise Linux

$ export NODE_PATH=/usr/local/lib/node_modules/@redhat:$NODE_PATH
Copy to Clipboard Toggle word wrap

Windows

$ set NODE_PATH=%AppData%\Roaming\npm\node_modules\@redhat;%NODE_PATH%
Copy to Clipboard Toggle word wrap

To test your installation, use the following command. It prints OK to the console if it successfully imports the installed library.

$ node -e 'require("rhea")' && echo OK
OK
Copy to Clipboard Toggle word wrap

2.3. Deploying the client in a browser

Red Hat build of Rhea can run inside a web browser. The NPM package includes a file named rhea.js at the following location that can be used in browser-based applications:

/usr/local/lib/node_modules/@redhat/rhea/dist/rhea.js
Copy to Clipboard Toggle word wrap

Copy the rhea.js file to a location exposed by your web server and reference it using the HTML <script> element, as in this example:

Example: Running the client in a browser

<!DOCTYPE html>
<html>
<head>
  <title>Example</title>
  <script src="rhea.js"></script>
</head>
<body>
  <script>
    const rhea = require("rhea");
    const container = rhea.create_container();

    container.on("message", (event) => {
        console.log(event.message.body);
    });

    const ws = container.websocket_connect(WebSocket);
    const details = ws("ws://example.net:5673", ["binary", "AMQPWSB10", "amqp"])

    const conn = container.connect({"connection_details": details});
    conn.open_receiver("notifications");
  </script>
</body>
Copy to Clipboard Toggle word wrap

2.4. Installing the examples

  1. Use the git clone command to clone the source repository to a local directory named rhea:
$ git clone https://github.com/amqp/rhea.git
Copy to Clipboard Toggle word wrap

Change to the rhea directory and use the git checkout command to checkout the commit associated with this release:

$ cd rhea
$ git checkout 3.0.2
Copy to Clipboard Toggle word wrap

The resulting local directory is referred to as <source-dir> in this guide.

Retour au début
Red Hat logoGithubredditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance. Découvrez nos récentes mises à jour.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez le Blog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

Theme

© 2025 Red Hat