Tuesday, September 26, 2017

Getting Started with RabbitMQ on Windows

1. ERLANG INSTALLATION

RabbitMQ runs on the Erlang virtual runtime, so we need to install Erlang first as without it we can't get RabbitMQ to work. Download Erlang at http://www.erlang.org/downloads
Ensures that the appropriate environment variable (ERLANG_HOME) has been created during the installation. If, for any reason, the environment variable is missing, you will need to create it manually.




2. RABBITMQ SERVICE INSTALLATION

Download and install Rabbit Service at http://www.rabbitmq.com/install-windows.html



3. RABBITMQ WEB MANAGEMENT PLUGIN ENABLE

RabbitMQ runs, by default, as a Windows Service and technically you shouldn’t need to do anything else to start interacting with it. However, any interaction with the service needs to happen over the command-line.


Open command line tool (Run as Administrator). The tool is located at C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.3.4\sbin
Run the following command to enable the plugin rabbitmq-plugins.bat enable rabbitmq_management
Then, re-install the RabbitMQ service using the commands below
rabbitmq-service.bat stop
rabbitmq-service.bat install
rabbitmq-service.bat start

To check if everything worked as expected, navigate to http://localhost:15672/mgmt. You will be prompted for username and password. The default credentials are:
Username: guest
Password: guest




4. INSTALL HANDLE.EXE FOR RABBITMQ’S FILE DESCRIPTORS

When you first log in to the RabbitMQ web dashboard, under the Overview tab you will notice that in the File descriptors field there is a question mark about the missing Handle.exe. Handle.exe enables RabbitMQ to monitor the local file system. It will still work without it but I think that it's better to make it available, so let’s go and get it at here

Download the zip file and unzip it anywhere you want. I decided to extract mine in C:\Program Files\Handle. It is important that you keep a note of the extracted path as we will need to add it to PATH environment variable so it is available to RabbitMQ.
Open the Environment Variables Windows, scroll down to the System Variables -> Path variable and click on Edit. At the end of the Variable Value, add the path to the Handle.exe by the path above
Restart the RabbitMQ
rabbitmq-service.bat stop
rabbitmq-service.bat start




5. SETUP

Now it is time to get it setup. The next batch script that we are going to use is rabbitmqctl.bat. This is the batch script that we are going to use to control and get stats on the server.
Run the command: rabbitmqctl status



You can now be sure that your RabbitMQ server is up and running, ready to server requests

The first thing you should consider doing, especially if your instance of RabbitMQ is publicly accessible, is to secure it a bit. If you run the command, rabbitmqctl list_users you will see that your server has a single user named “guest”. This is the default user that RabbitMQ creates, and it has full rights to the RabbitMQ instance. You might want to start off by creating a new user with a password and granting that user full rights. We can do this by running these commands:
rabbitmqctl add_user [username] [password]
rabbitmqctl set_permissions justin “.*” “.*” “.*”

The first command creates a new user with a password. The second tells RabbitMQ to grant the user configure, write, and read permissions to all queues

Now you can run: rabbitmqctl delete_user guest to delete guest




6. GET .NET RABBITMQ CLIENT

You can get RabbitMQ Client from Visual Studio with NuGet tool or go to the page at http://www.rabbitmq.com/dotnet.html to download it

Now, you are ready for coding!

Prefer this link for samples https://dotnetcodr.com/messaging/

No comments:

Post a Comment