Monday, September 23, 2013

RabbitMQ Installation

In this tutorial, we will go through the RabbitMQ installation and testing steps on local Windows 7 64-bit machine.
The steps are based on RabbitMQ 3.1.5 that was the latest release at the time of writing this tutorial.

Erlang Installation


As per described on Erlang Versions page, you will need Erlang R15B or later to run RabbitMQ on a 64bit Windows machine.


  1. Download R15B02 Windows 64 Bit Binary File from Erlang R15B02 download page.
  2. Double click the executable otp_win64_R15B02_with_MSVCR100_installer_fix.exe
  3. Follow the wizard steps (click the screen shots to see further details).



RabbitMQ Installation


  1. Download the latest available release of RabbitMQ 3.1.5 from download page
  2. Double click the executable rabbitmq-server-3.1.5.exe
  3. Follow the wizard steps (click the screen shots to see further details).


After the installation is completed, you will have RabbitMQ running on default port 5672
You can control RabbitMQ using the shortcuts in start menu:


Java Clients

RabbitMQ is a message broker. The principal idea is pretty simple: it accepts and forwards messages that are binary blobs of data.

In this part of the tutorial (details on how this works is available here) we'll write two programs in Java; a producer that sends a single message, and a consumer that receives messages and prints them out. It's a "Hello World" of messaging.
  1. Download the Java client from download page
  2. Extract the downloaded rabbitmq-java-client-bin-3.1.5.zip 
  3. Copy all *.jar files from the extracted folder to C:\RabbitMQ
  4. Copy the Send.java from this link (open this link and copy the code from there to C:\RabbitMQ\Send.java)
  5. Copy the Recv.java from this link (open this link and copy the code from there to C:\RabbitMQ\Recv.java)
  6. Make sure that JAVA_HOME/bin is part of PATH
  7. Run the following command to compile Send.java and Recv.java
cd C:\RabbitMQ
javac -cp rabbitmq-client.jar Send.java Recv.java

     8. Run the following command to start the consumer:

java -cp .;commons-io-1.2.jar;commons-cli-1.1.jar;rabbitmq-client.jar Recv
    
     9. Run the following command to start the producer:

java -cp .;commons-io-1.2.jar;commons-cli-1.1.jar;rabbitmq-client.jar Send



No comments:

Post a Comment