Tag Archives: rabbitmq_remote_setup

I was playing around with RabbitMQ today. For those who don't know what it is, RabbitMQ is a message broker - or what some might call a bus, message queue, or message-oriented middleware. In the most simplistic terms, it's a middleman. It sits between 2 or more applications, receiving and sending messages back and forth, which in turn most likely trigger some action within one or more of the applications.

One of the nicest things about this is you logically decouple the application instances from each other, so they don't have to know about each other's structure, objects, or even language. A Python script can send a message to RabbitMQ, and on the other end of the queue, a Ruby app can consume it. Another nice point is scalability - if you find performance of the queues is suffering, you can throw more hardware (or virtualized hardware) at the RabbitMQ instance, without needing to touch either of your applications.

So intros aside, on to my troubles. One issue I was having is attempting to start the server. I had installed RabbitMQ with Homebrew, and so there are a couple of methods to interact with the server. You can run these two commands, launchctl load ~/Library/LaunchAgents/homebrew.mxcl.rabbitmq.plist
to start it, and launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.rabbitmq.plist
to stop it.

Drawbacks should be obvious. The other command available is rabbitmq-server. Whenever I attempted to run this command, I kept getting an error message: rabbitmq-server command not found

Upon re-reading the docs, I found the cause of the problem. They literally tell you, "The RabbitMQ server scripts are installed into /usr/local/sbin. This is not automatically added to your path..."

So, to fix it, simply open up your .profile or .bash_profile, and add the recommended line. In my case, I use vi, so:

$ vi ~/.bash_profile

On lines 5 and 6 I had:

PATH=$PATH:$HOME/.rvm/bin
PATH="/usr/local/bin":$PATH

On line 7, I added:

PATH=$PATH:/usr/local/sbin

Then I wrote, quit, and did a

$source ~/.bash_profile 

in my open Terminal tabs, and I was off and running with "rabbitmq-server"