Getting started with rabbitmq

Download rabbitmq eBook

Remarks

This section provides an overview of what rabbitmq is, and why a developer might want to use it.

It should also mention any large subjects within rabbitmq, and link out to the related topics. Since the Documentation for rabbitmq is new, you may need to create initial versions of those related topics.

Versions

VersionRelease notesRelease date
3.6.5Release notes2016-08-05
3.6.4Release notes2016-07-29
3.6.3Release notes2016-07-06
3.6.2Release notes2016-05-19
3.6.1Release notes2016-03-01
3.6.0Release notes2015-12-22
3.5.7Release notes2015-12-15
3.5.6Release notes2015-10-07
3.5.5Release notes2015-09-24
3.5.4Release notes2015-07-22
3.5.3Release notes2015-05-22
3.5.2Release notes2015-05-12
3.5.1Release notes2015-04-03
3.5.0Release notes2015-03-11
3.4.4Release notes2015-02-11
3.4.3Release notes2015-01-07
3.4.2Release notes2014-11-26
3.4.1Release notes2014-10-29
3.4.0Release notes2014-10-21
3.3.5Release notes2014-08-11
3.3.4Release notes2014-06-24
3.3.3Release notes2014-06-17
3.3.2Release notes2014-06-09
3.3.1Release notes2014-04-29
3.3.0Release notes2014-04-02
3.2.4Release notes2014-03-04
3.2.3Release notes2014-01-23
3.2.2Release notes2013-12-11
3.2.1Release notes2013-11-07
3.2.0Release notes2013-10-23
3.1.5Release notes2013-08-15
3.1.4Release notes2013-08-07
3.1.3Release notes2013-06-26
3.1.2Release notes2013-06-24
3.1.1Release notes2013-05-21
3.1.0Release notes2013-05-01

Installing RabbitMQ on Ubuntu Server

A quick note before actually installing RabbitMQ: Ubuntu 14.04's Erlang packages have issues if you are using SSL with RabbitMQ, so you'll need to install a newer version than what the Ubuntu package maintainers provide, so use the binaries at https://www.erlang-solutions.com/resources/download.html, for Erlang 17.0 or higher.

Add RabbitMQ to the package repositories list:

echo 'deb http://www.rabbitmq.com/debian/ testing main' |
    sudo tee /etc/apt/sources.list.d/rabbitmq.list
 

And then add the signing key:

wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc |
    sudo apt-key add -
 

Then update and install:

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

RabbitMQ 'Hello World'

This code create a producer which send two messages to a queue, and a consumer which receives all the messages from that queue.

Code for producer.py (using the pika 0.10.0 Python client):

import pika

connection = pika.BlockingConnection(pika.ConnectionParameters(
        host='localhost'))
channel = connection.channel()

channel.queue_declare(queue='queueName')

channel.basic_publish(exchange='',
                      routing_key='queueName',
                      body='Hello')
channel.basic_publish(exchange='',
                      routing_key='queueName',
                      body='World!')
print("Message sent")
connection.close()
 

Code for consumer.py:

import pika

connection = pika.BlockingConnection(pika.ConnectionParameters(
        host='localhost'))
channel = connection.channel()

channel.queue_declare(queue='queueName')

def callback(ch, method, properties, body):
    print("Received message: %r" % body)

channel.basic_consume(callback,
                      queue='queueName',
                      no_ack=True)

print('Waiting for messages...')
channel.start_consuming()
 

The output is:

$ python receive.py
Waiting for messages...
Received message: 'Hello'
Received message: 'World!'
 

Other examples are available in the RabbitMQ tutorial page for other languages.

Stats

102 Contributors: 4
Friday, December 23, 2016
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook