RabbitMQ : Getting Started.

RabbitMQ libraries

RabbitMQ speaks a protocol called AMQP. To use Rabbit you’ll need a library that understands the same protocol as Rabbit. There is a choice of libraries for almost every programming language. For python it’s no different and there are a bunch of libraries to choose from:

Here we use pika. To install it you can use the pip package management tool:

$ sudo pip install pika==0.9.8

The installation depends on pip and git-core packages, you may need to install them first.

  • On Ubuntu:
    $ sudo apt-get install python-pip git-core
  • On Debian:
    $ sudo apt-get install python-setuptools git-core
    $ sudo easy_install pip
  • On Windows: To install easy_install, run the MS Windows Installer for setuptools
    > easy_install pip
    > pip install pika==0.9.8

Now, to as first step towards starting to use RabbitMQ you can have a look how this works.

These programs are analogous to any hello-world program we write in any other language.

Send_Msg.py : This python program works like a Producer. It sends a message on to RabbitMQ.It connects to the default Exchange and creates a queue called and then sends a message to the queue.

Recieve_Msg,py : This program shall consume the messages from the Hello_World named Queue.

At any time to see the queues created and the number of messages in the queue currently, run

 rabbitmqctl list_queues

How to Run : You can run one “python Send_Msg.py <your_message>” repetitively from one terminal and runRecieve_Msg.py in two or more different terminals and it would give you a clear understanding of how messages are being sent and recieved. Source : RabbitMQ Documentation.


About Rahul K Upadhyaya
I am a software developer. My core areas of interest lies in Openstack as a technology,Python as the Programming language and Linux (Ubuntu/CentOS) as my favoraite OSs. When I am not at work, you would find me with my Camera , clicking random weird Stuff and People. You can have a look at the pictures on http://rakrup.wordpress.com

One Response to RabbitMQ : Getting Started.

  1. this is a very helpful website!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: