Update code from https://github.com/dmi-try/marionette-collective
[packages/precise/mcollective.git] / website / reference / plugins / connector_stomp.md
1 ---
2 layout: default
3 title: STOMP Connector
4 toc: false
5 ---
6 [STOMP]: http://stomp.codehaus.org/
7 [ConnectorActiveMQ]: /mcollective/reference/plugins/connector_activemq.html
8 [ConnectorRabbitMQ]: /mcollective/reference/plugins/connector_rabbitmq.html
9
10 *NOTE:* This connector is being deprecated and will not be supported in versions newer than 2.2.x.  Please move to one of the [ConnectorActiveMQ] or [ConnectorRabbitMQ].
11
12 The stomp connector uses the [STOMP] rubygem to connect to compatible servers.  This is known to work with ActiveMQ and Stompserver.  Anecdotal evidence suggests it works with RabbitMQ's Stomp plugin.
13
14 This code will only work with version _1.1_ and _1.1.6_ or newer of the Stomp gem, the in between versions have threading issues.
15
16 As this connector tries to be as generic as possible it is hard to support all the advanced features of MCollective using it.  We do not recommend you use the directed mode
17 using this plugin, instead look towards specific ones written for ActiveMQ or your chosen middleware.
18
19 ## Middleware Layout
20
21 For broadcast messages this connector will create _topics_ with names like _/topic/<collective>.<agent>.command_ and replies will go to
22 _/topic/<collective>.<agent>.reply_
23
24 For directed messages it will create queues with names like _/queue/<collective>.mcollective.<md5 hash of identity>_.
25
26 You should configure appropriate ACLs on your middleware to allow this scheme
27
28 ## Configuring
29
30 ### Common Options
31 The most basic configuration method is supported in all versions of the gem:
32
33 {% highlight ini %}
34 connector = stomp
35 plugin.stomp.base64 = false
36 plugin.stomp.host = stomp.my.net
37 plugin.stomp.port = 61613
38 plugin.stomp.user = me
39 plugin.stomp.password = secret
40 {% endhighlight %}
41
42 You can override all of these settings using environment variables STOMP_SERVER, STOMP_PORT, STOMP_USER, STOMP_PASSWORD.  It is recommended that your _client.cfg_ do not have usernames and passwords in it, users should set their own in the environment.
43
44 If you are seeing issues with the Stomp gem logging protocol errors and resetting your connections, especially if you are using Ruby on Rails then set the _plugin.stomp.base64_ to true, this adds an additional layer of encoding on packets to make sure they don't interfere with UTF8 encoding used in Rails.
45
46 ### Failover Pools
47 Newer versions of the Stomp gem supports failover between multiple Stomp servers, you need at least _1.1.6_ to use this.
48
49 If you are using version _1.1.9_ and newer of the Stomp Gem and this method of configuration you will also receive more detailed
50 logging about connections, failures and other significant events.
51
52 {% highlight ini %}
53 connector = stomp
54 plugin.stomp.pool.size = 2
55 plugin.stomp.pool.host1 = stomp1
56 plugin.stomp.pool.port1 = 61613
57 plugin.stomp.pool.user1 = me
58 plugin.stomp.pool.password1 = secret
59
60 plugin.stomp.pool.host2 = stomp2
61 plugin.stomp.pool.port2 = 61613
62 plugin.stomp.pool.user2 = me
63 plugin.stomp.pool.password2 = secret
64 {% endhighlight %}
65
66 This gives it 2 servers to attempt to connect to, if the first one fails it will use the second.  As before usernames and passwords can be set with STOMP_USER, STOMP_PASSWORD.
67
68 If you do not specify a port it will default to _6163_
69
70 When using pools you can also specify the following options, these are the defaults in the Stomp 1.1.6 gem:
71
72 {% highlight ini %}
73 plugin.stomp.pool.initial_reconnect_delay = 0.01
74 plugin.stomp.pool.max_reconnect_delay = 30.0
75 plugin.stomp.pool.use_exponential_back_off = true
76 plugin.stomp.pool.back_off_multiplier = 2
77 plugin.stomp.pool.max_reconnect_attempts = 0
78 plugin.stomp.pool.randomize = false
79 plugin.stomp.pool.timeout = -1
80 plugin.stomp.pool.connect_timeout = 30
81 {% endhighlight %}
82
83 ### Message Priority
84
85 As of version 5.4 of ActiveMQ messages support priorities, you can pass in the needed
86 priority header by setting:
87
88 {% highlight ini %}
89 plugin.stomp.priority = 4
90 {% endhighlight %}