3 title: RabbitMQ Connector
6 [STOMP]: http://stomp.codehaus.org/
7 [RabbitStomp]: http://www.rabbitmq.com/stomp.html
8 [RabbitCLI]: http://www.rabbitmq.com/management-cli.html
10 The RabbitMQ connector uses the [STOMP] rubygem to connect to RabbitMQ servers.
12 This code will only work with version _1.2.2_ or newer of the Stomp gem.
14 ## Differences between RabbitMQ connector and Stomp Connector
16 The RabbitMQ connector requires MCollective 2.0.0 or newer.
18 While this plugin still uses the Stomp protocol to connect to RabbitMQ it does use a nubmer of
19 RabbitMQ specific optimizations to work well and as such is a Stomp connector specific to the
22 ## Configuring RabbitMQ
24 Basic installation of the RabbitMQ broker is out of scope for this document apart from the
25 basic broker you need to enable the [Stomp plugi][RabbitStomp] and the [CLI Management Tool][RabbitCLI].
27 With that in place you need to create a few exchanges, topics and queues for each of your
30 First we create a virtual host, user and some permissions on the vhost:
32 {% highlight console %}
33 rabbitmqadmin declare vhost=/mcollective
34 rabbitmqadmin declare user=mcollective password=changeme
35 rabbitmqadmin declare permission vhost=/mcollective user=mcollective configure=.* write=.* read=.*
38 And then we need to create two exchanges that the mcollective plugin needs:
40 {% highlight console %}
41 rabbitmqadmin declare exchange vhost=/mcollective name=mcollective_broadcast type=topic
42 rabbitmqadmin declare exchange vhost=/mcollective name=mcollective_directed type=direct
45 ## Configuring MCollective
50 A sample configuration can be seen below.
56 plugin.rabbitmq.vhost = /mcollective
57 plugin.rabbitmq.pool.size = 2
58 plugin.rabbitmq.pool.1.host = rabbit1
59 plugin.rabbitmq.pool.1.port = 61613
60 plugin.rabbitmq.pool.1.user = mcollective
61 plugin.rabbitmq.pool.1.password = changeme
63 plugin.rabbitmq.pool.2.host = rabbit2
64 plugin.rabbitmq.pool.2.port = 61613
65 plugin.rabbitmq.pool.2.user = mcollective
66 plugin.rabbitmq.pool.2.password = changeme
69 This gives it 2 servers to attempt to connect to, if the first one fails it will use the second. Usernames and passwords can be set
70 with the environment variables STOMP_USER, STOMP_PASSWORD.
72 If you do not specify a port it will default to _61613_
74 You can also specify the following options for the Stomp gem, these are the defaults in the Stomp 1.2.2 gem:
77 plugin.rabbitmq.initial_reconnect_delay = 0.01
78 plugin.rabbitmq.max_reconnect_delay = 30.0
79 plugin.rabbitmq.use_exponential_back_off = true
80 plugin.rabbitmq.back_off_multiplier = 2
81 plugin.rabbitmq.max_reconnect_attempts = 0
82 plugin.rabbitmq.randomize = false
83 plugin.rabbitmq.timeout = -1
84 plugin.rabbitmq.vhost = /