RabbitMQ for Windows: Introduction

If you’re interested in getting started with distributed programming and you develop on the Microsoft Windows platform, RabbitMQ may be what you’re looking for.  RabbitMQ is an open source, standards-based, multi-platform message broker with client libraries available for a host of development platforms including .Net.  

This series will provide a gentle introduction to getting started with RabbitMQ for .Net developers, including a Windows environment installation guide along with an introduction to basic concepts and features through the use of examples in C#.  In this first installment, we’ll cover installation and basic configuration.

Installation

The first thing to know about RabbitMQ installation is that RabbitMQ runs on the Erlang virtual runtime.  “What is Erlang”, you ask, and “Why should I ask our admins to install yet another runtime engine on our servers”?  Erlang is a functional language which places a large emphasis on concurrency and high reliability.  Developed by  Joe Armstrong, Mike Williams, and Robert Virding to support telephony applications at Ericsson, Erlang’s flagship product, the Ericsson AXD301 switch, is purported to have achieved a reliability of nine “9″s.

A popular quote among Erlang adherents is Verding’s “First Rule of Programming”:

“Any sufficiently complicated concurrent program in another language contains an ad hoc informally-specified bug-ridden slow implementation of half of Erlang.” – Robert Verding

Sound like the perfect platform to write a message broker in?  The authors of RabbitMQ thought so too.

With that, let’s get started with the installation.

 

Step 1: Install Erlang

The first step will be to download and install Erlang for Windows.  You can obtain the latest installer from here (version R15B at the time of this writing) .

After downloading and completing the Erlang installation wizard, you should have a new ERLANG_HOME environment variable set.  If not, you’ll want to set this now so RabbitMQ will be able to locate your installation of Erlang.

ErlangEnv

 

 

Step 2: Install RabbitMQ

Next, download and install the latest version of RabbitMQ for Windows from here (version 2.7.1 at the time of this writing).

 

Step 3: Install the RabbitMQ Management Plugin

By default, the RabbitMQ Windows installer registers RabbitMQ as a Windows service, so technically we’re all ready to go.  In addition to the command line utilities provided for managing and monitoring our RabbitMQ instance, a Web-based management plugin is also provided with the standard Windows distribution.  The following steps detail how to get the management plugin up and going.

First, from an elevated command prompt, change directory to the sbin folder within the RabbitMQ Server installation directory (e.g. %PROGRAMFILES%\RabbitMQ Server\rabbitmq_server_2.7.1\sbin\).

Next, run the following command to enable the rabbitmq management plugin:

rabbitmq-plugins.bat enable rabbitmq_management 

 

Lastly, to enable the management plugin we need to reinstall the RabbitMQ service.  Execute the following sequence of commands to reinstall the service:

 
rabbitmq-service.bat stop 
rabbitmq-service.bat install 
rabbitmq-service.bat start 

 

To verify management plugin is up and running, start your favorite browser and navigate to http://localhost:55672/mgmt/.  If everything went ok, you should see a screen similar to the following:

 

 RabbitManagement

From here, you’ll be able to configure and monitor your RabbitMQ instance.

That concludes our installation guide.  Next time, we’ll walk through writing our first RabbitMQ C# application.

About Derek Greer

Derek Greer is a consultant, aspiring software craftsman and agile enthusiast currently specializing in C# development on the .Net platform.
This entry was posted in Uncategorized and tagged . Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • Pingback: The Morning Brew - Chris Alcock » The Morning Brew #1058

  • Joe

    Derek,

    Can you cover when and why you’d use a a message queue solution (be it RabbitMQ or any other)?

    • Anonymous

      Hey, Joe.  Most situations where you have a point-to-point connection (e.g. client/server, RPC, Web Services, etc.) can be facilitated by messaging and often with more ease, so you might consider it for that reason alone. 

      Some situations where you should consider using messaging are:

      - When you have a heterogeneous development environment
      - When you have asynchronous workflow needs
      - When you need to monitor communication 
      - When you have high reliability needs
      - When you need scalability
      - When you hate XML

      • Fernando Zamora Jimenez

         hmmm… I always thought one of the big reasons for message queueing service was because both systems sender and receiver are not necessarily connected at the same time.  This would allow the receiver and sender to send and receive on independent schedules from one another.

        • Fernando Zamora Jimenez

           In other words the receiver may be down but it can pickup the messages once it comes backup since they are in a queue.  I’m not sure if the “asynchronous workflow” covers this already.

          • derekgreer

            Yep.

  • Pingback: RabbitMQ for Windows: Building Your First Application « async I/O News

  • Fernando Zamora Jimenez

    Thanks for sharing.  Can’t wait for your next post.  You kinda left me hanging! Just Kidding. Thanks again for sharing.

  • Bryan Nehl

    Thanks for this post.  I was trying to get the management console working with no luck and came across this post.  They key thing I was missing was to  run from an elevated command prompt.  Did that and got the server working!   Without that, everything looked like it was working and installed but the web server wasn’t up.  Thanks.  :)

  • Dmytro Kudryavtsev

    To use the web UI you will need to authenticate as a RabbitMQ user (on a fresh installation the user “guest” is created with password “guest”).
    http://www.rabbitmq.com/management.html 

    • Anonymous

      Yes, I should have included that in the article.  Thanks.

  • david

    thanks for your article it helps me a lot to enable the management plugin. I was using first RabbitMQ service (re) install on the start->all programs but only the sequence of commands you mentionned lastly enable the plugin.

  • Joel

    Hey Derek, ran across this researching .net amqp options. Nice to see that you’re using rabbit. It seems like the cannonical amqp impl. You rock bud..

    • derekgreer

      Thanks, Joel. Hope all is well in The Great State.

  • Rithish

    Wonderful tutorial. The web UI auth part is missed out; otherwise everything works as stated. :)

  • .Netnewbie

    I am having an issue running rabbitmq-plugins.bat enable rabbitmq_management .Its throwing an error Unable to create cookie file h:/ . I am working on my work pc and corporate policy sets the homedrive to h: which is not accessible. Is there any workaround ? ! Thanks !

  • Jayanth

    fantastic explanation on how to setu[ the UI for rabbitmq.

  • Josh

    Just a note that the management port for RabbitMQ versions 3.0+ is now 15672 instead of 55672

    • Kaushal

      Thanks for sharing this.

  • csharper

    I’ve see that Erlang quote before, but I’ve never seen anyone mention it’s almost a complete ripoff of Greenspuns tenth rule. http://en.wikipedia.org/wiki/Greenspun's_tenth_rule

    • derekgreer

      It’s certainly derivative and it’s probably true that many aren’t aware of the origin, but I don’t think it was originally set forth as an original idea. Some within the Haskell and Closure communities have also re-purposed this rather tongue-in-cheek description for themselves as well. It’s probably more accurate to think of it in the vein of a meme than a marketing slogan ripoff.