Quantcast
Channel: vijayakkineni » Fanout
Viewing all articles
Browse latest Browse all 2

RabbitMQ Series – Part 1 – Installation

$
0
0

Hello Readers,

In this tutorial I will be going over the magnificient RabbitMQ – Messaging that just works. There are plenty of message brokers out there in the market, the primary reason for choosing RabbitMQ is AMQP Protocol which has a numerous advantages over JMS.

JMS vs AMQP

  • Interoperability – When you have a bunch of applications in different languages NodeJS, Ruby, Java, C# and need a broker that bridges existing organization protocols being used  like STOMP or XMPP. AMQP is the Winner.
  • Routing – JMS uses simple message routing scheme where a producer sends a message to a queue and consumer consumes the message and message selectors are used to filter and routing. AMQP provides an additional layer called exchanges where producers place messages in Exchanges along with routing key and messages get routed to queue based on the binding between Exchanges and Queues. Messages get forwarded to the Queues from the Exchanges based on the binding and routing key. The decoupling of transport and queueing model allows sophisticated routing models and a variety of patterns that we use in daily life like Publish-Subscribe,    Work Queues, RPC over AMQP, Parallel Processing.
  • Message Models – JMS uses a Point-To-Point messaging over queues and Publish-Subscribe over Topics. In AMQP the different messaging models are Direct, FanOut, Topic, Headers and System Exchange. Mandatory exchanges that are provided by the vendor are Direct and Fanout. If we consider analogies Point-To-Point is similar to Direct Exchange and Publish-Subscribe without filtering to Fanout, Publish-Subscribe with filtering to Topic. System Exchanges I couldn’t find anything similar in JMS world. Header exchange is very mush similar to Direct but uses the message headers for the routing.

I think that gives a brief overview what the differences between JMS and AMQP are, without any further delay lets pull the rabbit out of the hat.

Installing RabbitMQ

RabbitMQ is implemented in Erlang and you will need an Erlang runtime. The latest version of RabbitMQ 3.2.1 works with Erlang R16B01 current version at the time of writing this, But I would prefer installing R15B01 if you are also planing to install  Riak along with Rabbit as Riak 1.4.2 depends on R15B01.

The most easiest way to install Erlang is to use Kerl.

curl -O https://raw.github.com/spawngrid/kerl/master/kerl && chmod a+x kerl

Check the list of installations prodded by kern and choose one to build. Additional configuration options can be provided through ~/.kerlrc .

kerl list releases
kerl build R15B01 r15b01
kerl install r15b01 /path/to/install/directory
. /path/to/install/directory

At this point of time erlang should be installed on your system. check the installed erlang version by issuing “erl -v” command.

I am on a debian based linux system(Linux Mint), so the below instructions are to install Rabbit on a  debian based system. There are two ways to install Rabbit you can either download the  latest .deb file and open it via package manager or install it using the  apt repository provided by Rabbit guys.

Add the following line to your /etc/apt/sources.list:

deb http://www.rabbitmq.com/debian/ testing main

To avoid the unsigned package errors

wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
sudo apt-key add rabbitmq-signing-key-public.asc

To install rabbit

sudo apt-get update
sudo apt-get install rabbitmq-server

And finally set the system file handling limit to 4096 (default 1024) by issuing “ulimit -n 4096″.

Now you are all set to fire up the server.

 sudo service rabbitmq-server start

Now in a new terminal window you can check the status by “rabbitmqctl status”

You are all ready to do the magic now. This is the reason i love RabbitMQ so much. so very easy to install and in the next part lets deep dive into Exchanges, Messages, Topics, Virtual Host and writing a hello world program in Java. Stay tuned!!.



Viewing all articles
Browse latest Browse all 2

Trending Articles