< Table of Contents

Integrate RabbitMQ Messaging

In this procedure, you will learn how to integrate Kaazing Gateway and RabbitMQ, a highly reliable enterprise messaging system based on the AMQP standard.

Note: The instructions in this topic use RabbitMQ 3.3.0.

To Integrate RabbitMQ Messaging

  1. Set up RabbitMQ.
    1. Download and install RabbitMQ by following the instructions on the RabbitMQ website. The root folder for the RabbitMQ installation will be referred to as RABBITMQ_HOME in this procedure. Note that RabbitMQ requires that Erlang is installed and running on the server running RabbitMQ.
    2. Open a shell or command prompt on the location RABBITMQ_HOME/sbin.
    3. Start RabbitMQ by running the following command:

      For Windows:
      rabbitmq-server.bat

      For Mac and Linux:
      ./rabbitmq-server

      The output will contain the following:
      Starting broker... completed with 1 plugins

      The RabbitMQ broker is started along with the installed plugin.

  2. Download and install the Gateway as described in Setting Up the Gateway and Clients.
  3. Download the Kaazing AMQP JavaScript tutorial located on Github at https://github.com/kaazing/javascript.client.tutorials/tree/develop/amqp.
  4. Open the configuration file for the Gateway, located at GATEWAY_HOME/conf/gateway-config.xml.
  5. Locate the amqp.proxy service:

      <service>
        <accept>ws://${gateway.hostname}:${gateway.extras.port}/amqp</accept>
        <connect>tcp://${broker.hostname}:5672</connect>
        <type>amqp.proxy</type>
        <properties>
          <service.domain>${gateway.hostname}</service.domain>
          <encryption.key.alias>session</encryption.key.alias>
        </properties>
    
        <realm-name>demo</realm-name>
    
        <!--
        <authorization-constraint>
        <require-role>AUTHORIZED</require-role>
        </authorization-constraint>
        -->
    
        <cross-site-constraint>
        <allow-origin>http://${gateway.hostname}:${gateway.extras.port}</allow-origin>
      </cross-site-constraint>
    </service>
    

    Note that the connect element uses the default AMQP port 5672. For information on other properties that may be configured for the amqp.proxy service, see amqp.proxy.

  6. Start the Gateway as described in Setting Up the Gateway.
  7. Test the Gateway RabbitMQ integration.

    1. In a browser, navigate to the index.html file in the Kaazing AMQP JavaScript tutorial you download.
    2. In Location, enter ws://localhost:8001/amqp and click Connect.
      The status message CONNECTING: ws://localhost:8001/amqp guest appears followed by CONNECTED.
    3. Using the demo, publish messages to an exchange, control flow, commit and rollback messages.

See Also