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
- Set up RabbitMQ.
- 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. - Open a shell or command prompt on the location
RABBITMQ_HOME/sbin
. -
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.
- Download and install RabbitMQ by following the instructions on the RabbitMQ website. The root folder for the RabbitMQ installation will be referred to as
- Download and install the Gateway as described in Setting Up the Gateway and Clients.
- Download the Kaazing AMQP JavaScript tutorial located on Github at https://github.com/kaazing/javascript.client.tutorials/tree/develop/amqp.
- Open the configuration file for the Gateway, located at
GATEWAY_HOME/conf/gateway-config.xml
. -
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. - Start the Gateway as described in Setting Up the Gateway.
-
Test the Gateway RabbitMQ integration.
- In a browser, navigate to the index.html file in the Kaazing AMQP JavaScript tutorial you download.
- In Location, enter
ws://localhost:8001/amqp
and click Connect.
The status messageCONNECTING: ws://localhost:8001/amqp guest
appears followed byCONNECTED
. - Using the demo, publish messages to an exchange, control flow, commit and rollback messages.
See Also
- For general troubleshooting information, see Troubleshoot the Gateway.
- For information on AMQP and RabbitMQ, see AMQP 0-9-1 Model Explained, RabbitMQ Documentation, Downloading and Installing RabbitMQ.
- Running Erlang on Mac OS X.