isimud 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/.rspec +2 -0
  4. data/.ruby-version +1 -0
  5. data/.yardoc/checksums +15 -0
  6. data/.yardoc/object_types +0 -0
  7. data/.yardoc/objects/root.dat +0 -0
  8. data/.yardoc/proxy_types +0 -0
  9. data/Gemfile +23 -0
  10. data/Gemfile.lock +123 -0
  11. data/README.md +218 -0
  12. data/Rakefile +2 -0
  13. data/config.ru +7 -0
  14. data/config/tddium.yml +11 -0
  15. data/doc/Isimud.html +1696 -0
  16. data/doc/Isimud/BunnyClient.html +1004 -0
  17. data/doc/Isimud/Client.html +812 -0
  18. data/doc/Isimud/Event.html +1500 -0
  19. data/doc/Isimud/EventListener.html +1217 -0
  20. data/doc/Isimud/EventObserver.html +367 -0
  21. data/doc/Isimud/EventObserver/ClassMethods.html +292 -0
  22. data/doc/Isimud/Generators.html +117 -0
  23. data/doc/Isimud/Generators/ConfigGenerator.html +192 -0
  24. data/doc/Isimud/Generators/InitializerGenerator.html +192 -0
  25. data/doc/Isimud/Logging.html +230 -0
  26. data/doc/Isimud/ModelWatcher.html +312 -0
  27. data/doc/Isimud/ModelWatcher/ClassMethods.html +511 -0
  28. data/doc/Isimud/Railtie.html +123 -0
  29. data/doc/Isimud/TestClient.html +1003 -0
  30. data/doc/Isimud/TestClient/Queue.html +556 -0
  31. data/doc/_index.html +290 -0
  32. data/doc/class_list.html +58 -0
  33. data/doc/css/common.css +1 -0
  34. data/doc/css/full_list.css +57 -0
  35. data/doc/css/style.css +339 -0
  36. data/doc/file.README.html +338 -0
  37. data/doc/file_list.html +60 -0
  38. data/doc/frames.html +26 -0
  39. data/doc/index.html +338 -0
  40. data/doc/js/app.js +219 -0
  41. data/doc/js/full_list.js +181 -0
  42. data/doc/js/jquery.js +4 -0
  43. data/doc/method_list.html +711 -0
  44. data/doc/top-level-namespace.html +112 -0
  45. data/isimud.gemspec +25 -0
  46. data/lib/isimud.rb +91 -0
  47. data/lib/isimud/bunny_client.rb +95 -0
  48. data/lib/isimud/client.rb +48 -0
  49. data/lib/isimud/event.rb +112 -0
  50. data/lib/isimud/event_listener.rb +200 -0
  51. data/lib/isimud/event_observer.rb +81 -0
  52. data/lib/isimud/logging.rb +11 -0
  53. data/lib/isimud/model_watcher.rb +144 -0
  54. data/lib/isimud/railtie.rb +9 -0
  55. data/lib/isimud/tasks.rb +20 -0
  56. data/lib/isimud/test_client.rb +89 -0
  57. data/lib/isimud/version.rb +3 -0
  58. data/lib/rails/generators/isimud/config_generator.rb +12 -0
  59. data/lib/rails/generators/isimud/initializer_generator.rb +12 -0
  60. data/lib/rails/generators/isimud/templates/initializer.rb +17 -0
  61. data/lib/rails/generators/isimud/templates/isimud.yml +20 -0
  62. data/spec/internal/app/models/admin.rb +2 -0
  63. data/spec/internal/app/models/company.rb +34 -0
  64. data/spec/internal/app/models/user.rb +27 -0
  65. data/spec/internal/config/database.yml +3 -0
  66. data/spec/internal/config/routes.rb +3 -0
  67. data/spec/internal/db/schema.rb +22 -0
  68. data/spec/internal/log/.gitignore +1 -0
  69. data/spec/internal/public/favicon.ico +0 -0
  70. data/spec/isimud/bunny_client_spec.rb +125 -0
  71. data/spec/isimud/event_listener_spec.rb +86 -0
  72. data/spec/isimud/event_observer_spec.rb +32 -0
  73. data/spec/isimud/event_spec.rb +74 -0
  74. data/spec/isimud/model_watcher_spec.rb +189 -0
  75. data/spec/isimud/test_client_spec.rb +28 -0
  76. data/spec/isimud_spec.rb +49 -0
  77. data/spec/spec_helper.rb +55 -0
  78. metadata +195 -0
@@ -0,0 +1,338 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
+ <title>
7
+ File: README
8
+
9
+ &mdash; Documentation by YARD 0.8.7.6
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!file.README.html";
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index</a> &raquo;
35
+ <span class="title">File: README</span>
36
+
37
+
38
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
39
+ </div>
40
+
41
+ <div id="search">
42
+
43
+ <a class="full_list_link" id="class_list_link"
44
+ href="class_list.html">
45
+ Class List
46
+ </a>
47
+
48
+ <a class="full_list_link" id="method_list_link"
49
+ href="method_list.html">
50
+ Method List
51
+ </a>
52
+
53
+ <a class="full_list_link" id="file_list_link"
54
+ href="file_list.html">
55
+ File List
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <iframe id="search_frame"></iframe>
63
+
64
+ <div id="content"><div id='filecontents'>
65
+ <h1 id="label-Isimud-3A+AMQP+based+Messaging+abstraction+component.">Isimud: AMQP based Messaging abstraction component.</h1>
66
+
67
+ <blockquote>
68
+ <p>Isimud is a minor god, the messenger of the god Enki in Sumerian mythology.
69
+ He is readily identifiable by the fact that he possesses two faces looking
70
+ in opposite directions.</p>
71
+
72
+ <p><em>Source: Wikipedia</em></p>
73
+ </blockquote>
74
+
75
+ <p>Isimud is a message publishing and consumption gem. It consists of the
76
+ following components:</p>
77
+ <ul><li>
78
+ <p>A <a href="http://rubybunny.info">Bunny</a> based client interface for
79
+ publishing and receiving messages using AMQP.</p>
80
+ </li><li>
81
+ <p>A test client which mocks most client operations and allows for synchronous
82
+ delivery and processing of messages for unit tests.</p>
83
+ </li><li>
84
+ <p>A Model Watcher mixin for ActiveRecord that automatically sends messages
85
+ whenever an ActiveRecord instance is created, modified, or destroyed.</p>
86
+ </li><li>
87
+ <p>An Event Observer mixin for registering ActiveRecord models and instances
88
+ with the EventListener for receiving messages.</p>
89
+ </li><li>
90
+ <p>An Event Listener daemon process which manages queues for Event Observers.</p>
91
+ </li></ul>
92
+
93
+ <h2 id="label-Installation">Installation</h2>
94
+
95
+ <p>Add this line to your application&#39;s Gemfile:</p>
96
+
97
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>isimud</span><span class='tstring_end'>&#39;</span></span>
98
+ </code></pre>
99
+
100
+ <p>And then execute:</p>
101
+
102
+ <pre class="code ruby"><code class="ruby">$ bundle</code></pre>
103
+
104
+ <p>Or install it yourself as:</p>
105
+
106
+ <pre class="code ruby"><code class="ruby">$ gem install isimud</code></pre>
107
+
108
+ <p>For Rails applications, use the following generators to create config and
109
+ initializer files, respectively:</p>
110
+
111
+ <pre class="code ruby"><code class="ruby">$ rails g isimud:config
112
+ $ rails g isimud:initializer</code></pre>
113
+
114
+ <p>Customize the AMQP broker settings in the config/isimud.yml</p>
115
+
116
+ <h2 id="label-Usage">Usage</h2>
117
+
118
+ <h3 id="label-Connecting+to+an+AMQP+server">Connecting to an AMQP server</h3>
119
+
120
+ <p>There are two supported conventions for specifying a RabbitMQ server
121
+ (broker) in the configuration file:</p>
122
+
123
+ <h4 id="label-Using+a+URL">Using a URL</h4>
124
+
125
+ <pre class="code ruby"><code class="ruby">server: amqp:port//user_name:password@host/vhost</code></pre>
126
+
127
+ <h4 id="label-Using+separate+parameters-3A">Using separate parameters:</h4>
128
+
129
+ <pre class="code ruby"><code class="ruby">server:
130
+ host: hostname
131
+ port: 15672
132
+ user: user_name
133
+ pass: password
134
+ vhost: vhost</code></pre>
135
+
136
+ <p><a href="http://rubybunny.info/articles/connecting.html">Complete list of
137
+ Bunny options available here</a></p>
138
+
139
+ <p>Isimud is designed to work with <a
140
+ href="http://www.rabbitmq.com">RabbitMQ</a>. Besides the standard AMQP
141
+ 0.9.1 protocol, Isimud relies on Publishing Confirms (Acknowledgements),
142
+ which is a RabbitMQ specific extension to AMQP 0.9.1.</p>
143
+
144
+ <p>Note that Isimud does not automatically create exchanges. Make sure the
145
+ exchange has been declared on the message server, or you will get an
146
+ exception. It is highly recommended to set the /durable/ parameter on the
147
+ exchange in order to prevent loss of messages due to failures.</p>
148
+
149
+ <p>Isimud uses <a href="http://rubybunny.info">Bunny</a> to connect to
150
+ RabbitMQ.</p>
151
+
152
+ <h3 id="label-Message+publication">Message publication</h3>
153
+
154
+ <p>Isimud uses topic based exchanges publish messages. This allows for
155
+ multiple listener workers to operate in parallel to process messages.</p>
156
+
157
+ <h3 id="label-Message+binding+and+consumption">Message binding and consumption</h3>
158
+
159
+ <p>Isimud uses non-exclusive, durable queues to listen for and consume
160
+ messages. Named queues are automatically created if they do not exist.</p>
161
+
162
+ <h2 id="label-Changes">Changes</h2>
163
+
164
+ <h3 id="label-0.4.2">0.4.2</h3>
165
+ <ul><li>
166
+ <p>Fixed issue with exception handling</p>
167
+ </li></ul>
168
+
169
+ <h3 id="label-0.4.1">0.4.1</h3>
170
+ <ul><li>
171
+ <p>Event now accepts an exchange option for publishing</p>
172
+ </li><li>
173
+ <p>Added Isimud.events_exchange</p>
174
+ </li><li>
175
+ <p>Cleaned up initializer template</p>
176
+ </li></ul>
177
+
178
+ <h3 id="label-0.4.0">0.4.0</h3>
179
+ <ul><li>
180
+ <p>Event logging of published message now set to debug level</p>
181
+ </li><li>
182
+ <p>Added EventListener and EventObserver</p>
183
+ </li><li>
184
+ <p>Added new Client methods: create_queue, delete_queue. It is now possible to
185
+ create queues with customized options (such as exclusive, non-durable
186
+ queues).</p>
187
+ </li><li>
188
+ <p>Clients can now be configured with an exception handler. This is used by
189
+ EventListener to intercept exceptions raised during message handling by an
190
+ observer.</p>
191
+ </li></ul>
192
+
193
+ <h3 id="label-0.3.7">0.3.7</h3>
194
+ <ul><li>
195
+ <p>Added EventObserver mix-in</p>
196
+ </li><li>
197
+ <p>Added accessors for queues and routing_keys to TestClient</p>
198
+ </li></ul>
199
+
200
+ <h3 id="label-0.3.6">0.3.6</h3>
201
+ <ul><li>
202
+ <p>Reraise all exceptions in message processing block in BunnyClient#bind.</p>
203
+ </li></ul>
204
+
205
+ <h3 id="label-0.3.5">0.3.5</h3>
206
+ <ul><li>
207
+ <p>Fixed deprecation on setting manual ack on Bunny queue subscriptions.</p>
208
+ </li></ul>
209
+
210
+ <h3 id="label-0.3.4">0.3.4</h3>
211
+ <ul><li>
212
+ <p>Catch Timeout::Error in ModelWatcher.synchronize</p>
213
+ </li></ul>
214
+
215
+ <h3 id="label-0.3.1">0.3.1</h3>
216
+ <ul><li>
217
+ <p>Tuning gargabe collector on ModelWatcher.synchronize</p>
218
+ </li></ul>
219
+
220
+ <h3 id="label-0.3.0">0.3.0</h3>
221
+ <ul><li>
222
+ <p>Added rake task for manual synchronization using ModelWatcher</p>
223
+ </li></ul>
224
+
225
+ <h3 id="label-0.2.17">0.2.17</h3>
226
+ <ul><li>
227
+ <p>Added guard on null #updated_at instances</p>
228
+ </li><li>
229
+ <p>Added ModelWatcher#isimud_sync for manual synchronization</p>
230
+ </li></ul>
231
+
232
+ <h3 id="label-0.2.15">0.2.15</h3>
233
+ <ul><li>
234
+ <p>Changed Event#send to Event#publish, to avoid overloading Ruby.</p>
235
+ </li></ul>
236
+
237
+ <h3 id="label-0.2.13">0.2.13</h3>
238
+ <ul><li>
239
+ <p>Add :omit_parameters option to Event#as_json</p>
240
+ </li></ul>
241
+
242
+ <h3 id="label-0.2.12">0.2.12</h3>
243
+ <ul><li>
244
+ <p>Demodulize ActiveRecord model name when setting ModelWatcher event type</p>
245
+ </li></ul>
246
+
247
+ <h3 id="label-0.2.10">0.2.10</h3>
248
+ <ul><li>
249
+ <p>Added Isimud.retry_failures</p>
250
+ </li><li>
251
+ <p>Isimud::ModelWatcher now includes :created_at and :updated_at columns by
252
+ default</p>
253
+ </li><li>
254
+ <p>Added Isimud::Client.connected?</p>
255
+ </li><li>
256
+ <p>Avoid connecting to database when Isimud::ModelWatcher.watch_attributes is
257
+ called</p>
258
+ </li></ul>
259
+
260
+ <h3 id="label-0.2.4">0.2.4</h3>
261
+ <ul><li>
262
+ <p>Add Isimud::ModelWatcher#isimud_synchronize? to allow conditional
263
+ synchronization. Override to activate.</p>
264
+ </li></ul>
265
+
266
+ <h3 id="label-0.2.2">0.2.2</h3>
267
+ <ul><li>
268
+ <p>Add enable_model_watcher configuration parameter (default is true)</p>
269
+ </li></ul>
270
+
271
+ <h3 id="label-0.2.0">0.2.0</h3>
272
+ <ul><li>
273
+ <p>Added Isimud::Event</p>
274
+ </li><li>
275
+ <p>Extracted Isimud::Client#log into Isimud::Logging module</p>
276
+ </li></ul>
277
+
278
+ <h3 id="label-0.1.4">0.1.4</h3>
279
+ <ul><li>
280
+ <p>Don&#39;t reject messages when exception is raised in bind block</p>
281
+ </li></ul>
282
+
283
+ <h3 id="label-0.1.3">0.1.3</h3>
284
+ <ul><li>
285
+ <p>Upgrade bunny gem requirement to 1.3.x</p>
286
+ </li><li>
287
+ <p>Fixed message acknowledgements</p>
288
+ </li><li>
289
+ <p>Added log_level configuration parameter (default is :debug)</p>
290
+ </li></ul>
291
+
292
+ <h3 id="label-0.1.2">0.1.2</h3>
293
+ <ul><li>
294
+ <p>Reject message with requeue when an exception is raised during processing</p>
295
+ </li></ul>
296
+
297
+ <h3 id="label-0.1.1">0.1.1</h3>
298
+ <ul><li>
299
+ <p>Enable channel confirmations for message publication</p>
300
+ </li></ul>
301
+
302
+ <h3 id="label-0.1.0">0.1.0</h3>
303
+ <ul><li>
304
+ <p>ModelWatcher mix-in for ActiveRecord, sends events on instance changes</p>
305
+ </li><li>
306
+ <p>Initializer generator for Rails</p>
307
+ </li></ul>
308
+
309
+ <h3 id="label-0.0.8+-28first+working+version-29">0.0.8 (first working version)</h3>
310
+ <ul><li>
311
+ <p>Don&#39;t clear the queues when reconnecting TestClient</p>
312
+ </li></ul>
313
+
314
+ <h2 id="label-Contributing">Contributing</h2>
315
+ <ol><li>
316
+ <p>Fork it ( <a
317
+ href="https://github.com/[my-github-username]/isimud/fork">github.com/[my-github-username]/isimud/fork</a>
318
+ )</p>
319
+ </li><li>
320
+ <p>Create your feature branch (<code>git checkout -b my-new-feature</code>)</p>
321
+ </li><li>
322
+ <p>Commit your changes (<code>git commit -am &#39;Add some
323
+ feature&#39;</code>)</p>
324
+ </li><li>
325
+ <p>Push to the branch (<code>git push origin my-new-feature</code>)</p>
326
+ </li><li>
327
+ <p>Create a new Pull Request</p>
328
+ </li></ol>
329
+ </div></div>
330
+
331
+ <div id="footer">
332
+ Generated on Fri Apr 3 09:28:08 2015 by
333
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
334
+ 0.8.7.6 (ruby-2.2.1).
335
+ </div>
336
+
337
+ </body>
338
+ </html>
@@ -0,0 +1,60 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+
7
+ <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
8
+
9
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
10
+
11
+
12
+
13
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
16
+
17
+
18
+ <title>File List</title>
19
+ <base id="base_target" target="_parent" />
20
+ </head>
21
+ <body>
22
+ <script type="text/javascript" charset="utf-8">
23
+ var hasFrames = false;
24
+ try {
25
+ hasFrames = window.top.frames.main ? true : false;
26
+ } catch (e) { }
27
+ if (hasFrames) {
28
+ document.getElementById('base_target').target = 'main';
29
+ document.body.className = 'frames';
30
+ }
31
+ </script>
32
+ <div id="content">
33
+ <h1 id="full_list_header">File List</h1>
34
+ <div id="nav">
35
+
36
+ <span><a target="_self" href="class_list.html">
37
+ Classes
38
+ </a></span>
39
+
40
+ <span><a target="_self" href="method_list.html">
41
+ Methods
42
+ </a></span>
43
+
44
+ <span><a target="_self" href="file_list.html">
45
+ Files
46
+ </a></span>
47
+
48
+ </div>
49
+ <div id="search">Search: <input type="text" /></div>
50
+
51
+ <ul id="full_list" class="file">
52
+
53
+
54
+ <li class="r1"><span class="object_link"><a href="index.html" title="README">README</a></a></li>
55
+
56
+
57
+ </ul>
58
+ </div>
59
+ </body>
60
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
+ <title>Documentation by YARD 0.8.7.6</title>
8
+ </head>
9
+ <script type="text/javascript" charset="utf-8">
10
+ window.onload = function() {
11
+ var match = unescape(window.location.hash).match(/^#!(.+)/);
12
+ var name = match ? match[1] : 'index.html';
13
+ name = name.replace(/^(\w+):\/\//, '').replace(/^\/\//, '');
14
+ document.writeln('<frameset cols="20%,*">' +
15
+ '<frame name="list" src="class_list.html" />' +
16
+ '<frame name="main" src="' + escape(name) + '" />' +
17
+ '</frameset>');
18
+ }
19
+ </script>
20
+ <noscript>
21
+ <frameset cols="20%,*">
22
+ <frame name="list" src="class_list.html" />
23
+ <frame name="main" src="index.html" />
24
+ </frameset>
25
+ </noscript>
26
+ </html>
@@ -0,0 +1,338 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
+ <title>
7
+ File: README
8
+
9
+ &mdash; Documentation by YARD 0.8.7.6
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!file.README.html";
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index</a> &raquo;
35
+ <span class="title">File: README</span>
36
+
37
+
38
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
39
+ </div>
40
+
41
+ <div id="search">
42
+
43
+ <a class="full_list_link" id="class_list_link"
44
+ href="class_list.html">
45
+ Class List
46
+ </a>
47
+
48
+ <a class="full_list_link" id="method_list_link"
49
+ href="method_list.html">
50
+ Method List
51
+ </a>
52
+
53
+ <a class="full_list_link" id="file_list_link"
54
+ href="file_list.html">
55
+ File List
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <iframe id="search_frame"></iframe>
63
+
64
+ <div id="content"><div id='filecontents'>
65
+ <h1 id="label-Isimud-3A+AMQP+based+Messaging+abstraction+component.">Isimud: AMQP based Messaging abstraction component.</h1>
66
+
67
+ <blockquote>
68
+ <p>Isimud is a minor god, the messenger of the god Enki in Sumerian mythology.
69
+ He is readily identifiable by the fact that he possesses two faces looking
70
+ in opposite directions.</p>
71
+
72
+ <p><em>Source: Wikipedia</em></p>
73
+ </blockquote>
74
+
75
+ <p>Isimud is a message publishing and consumption gem. It consists of the
76
+ following components:</p>
77
+ <ul><li>
78
+ <p>A <a href="http://rubybunny.info">Bunny</a> based client interface for
79
+ publishing and receiving messages using AMQP.</p>
80
+ </li><li>
81
+ <p>A test client which mocks most client operations and allows for synchronous
82
+ delivery and processing of messages for unit tests.</p>
83
+ </li><li>
84
+ <p>A Model Watcher mixin for ActiveRecord that automatically sends messages
85
+ whenever an ActiveRecord instance is created, modified, or destroyed.</p>
86
+ </li><li>
87
+ <p>An Event Observer mixin for registering ActiveRecord models and instances
88
+ with the EventListener for receiving messages.</p>
89
+ </li><li>
90
+ <p>An Event Listener daemon process which manages queues for Event Observers.</p>
91
+ </li></ul>
92
+
93
+ <h2 id="label-Installation">Installation</h2>
94
+
95
+ <p>Add this line to your application&#39;s Gemfile:</p>
96
+
97
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>isimud</span><span class='tstring_end'>&#39;</span></span>
98
+ </code></pre>
99
+
100
+ <p>And then execute:</p>
101
+
102
+ <pre class="code ruby"><code class="ruby">$ bundle</code></pre>
103
+
104
+ <p>Or install it yourself as:</p>
105
+
106
+ <pre class="code ruby"><code class="ruby">$ gem install isimud</code></pre>
107
+
108
+ <p>For Rails applications, use the following generators to create config and
109
+ initializer files, respectively:</p>
110
+
111
+ <pre class="code ruby"><code class="ruby">$ rails g isimud:config
112
+ $ rails g isimud:initializer</code></pre>
113
+
114
+ <p>Customize the AMQP broker settings in the config/isimud.yml</p>
115
+
116
+ <h2 id="label-Usage">Usage</h2>
117
+
118
+ <h3 id="label-Connecting+to+an+AMQP+server">Connecting to an AMQP server</h3>
119
+
120
+ <p>There are two supported conventions for specifying a RabbitMQ server
121
+ (broker) in the configuration file:</p>
122
+
123
+ <h4 id="label-Using+a+URL">Using a URL</h4>
124
+
125
+ <pre class="code ruby"><code class="ruby">server: amqp:port//user_name:password@host/vhost</code></pre>
126
+
127
+ <h4 id="label-Using+separate+parameters-3A">Using separate parameters:</h4>
128
+
129
+ <pre class="code ruby"><code class="ruby">server:
130
+ host: hostname
131
+ port: 15672
132
+ user: user_name
133
+ pass: password
134
+ vhost: vhost</code></pre>
135
+
136
+ <p><a href="http://rubybunny.info/articles/connecting.html">Complete list of
137
+ Bunny options available here</a></p>
138
+
139
+ <p>Isimud is designed to work with <a
140
+ href="http://www.rabbitmq.com">RabbitMQ</a>. Besides the standard AMQP
141
+ 0.9.1 protocol, Isimud relies on Publishing Confirms (Acknowledgements),
142
+ which is a RabbitMQ specific extension to AMQP 0.9.1.</p>
143
+
144
+ <p>Note that Isimud does not automatically create exchanges. Make sure the
145
+ exchange has been declared on the message server, or you will get an
146
+ exception. It is highly recommended to set the /durable/ parameter on the
147
+ exchange in order to prevent loss of messages due to failures.</p>
148
+
149
+ <p>Isimud uses <a href="http://rubybunny.info">Bunny</a> to connect to
150
+ RabbitMQ.</p>
151
+
152
+ <h3 id="label-Message+publication">Message publication</h3>
153
+
154
+ <p>Isimud uses topic based exchanges publish messages. This allows for
155
+ multiple listener workers to operate in parallel to process messages.</p>
156
+
157
+ <h3 id="label-Message+binding+and+consumption">Message binding and consumption</h3>
158
+
159
+ <p>Isimud uses non-exclusive, durable queues to listen for and consume
160
+ messages. Named queues are automatically created if they do not exist.</p>
161
+
162
+ <h2 id="label-Changes">Changes</h2>
163
+
164
+ <h3 id="label-0.4.2">0.4.2</h3>
165
+ <ul><li>
166
+ <p>Fixed issue with exception handling</p>
167
+ </li></ul>
168
+
169
+ <h3 id="label-0.4.1">0.4.1</h3>
170
+ <ul><li>
171
+ <p>Event now accepts an exchange option for publishing</p>
172
+ </li><li>
173
+ <p>Added Isimud.events_exchange</p>
174
+ </li><li>
175
+ <p>Cleaned up initializer template</p>
176
+ </li></ul>
177
+
178
+ <h3 id="label-0.4.0">0.4.0</h3>
179
+ <ul><li>
180
+ <p>Event logging of published message now set to debug level</p>
181
+ </li><li>
182
+ <p>Added EventListener and EventObserver</p>
183
+ </li><li>
184
+ <p>Added new Client methods: create_queue, delete_queue. It is now possible to
185
+ create queues with customized options (such as exclusive, non-durable
186
+ queues).</p>
187
+ </li><li>
188
+ <p>Clients can now be configured with an exception handler. This is used by
189
+ EventListener to intercept exceptions raised during message handling by an
190
+ observer.</p>
191
+ </li></ul>
192
+
193
+ <h3 id="label-0.3.7">0.3.7</h3>
194
+ <ul><li>
195
+ <p>Added EventObserver mix-in</p>
196
+ </li><li>
197
+ <p>Added accessors for queues and routing_keys to TestClient</p>
198
+ </li></ul>
199
+
200
+ <h3 id="label-0.3.6">0.3.6</h3>
201
+ <ul><li>
202
+ <p>Reraise all exceptions in message processing block in BunnyClient#bind.</p>
203
+ </li></ul>
204
+
205
+ <h3 id="label-0.3.5">0.3.5</h3>
206
+ <ul><li>
207
+ <p>Fixed deprecation on setting manual ack on Bunny queue subscriptions.</p>
208
+ </li></ul>
209
+
210
+ <h3 id="label-0.3.4">0.3.4</h3>
211
+ <ul><li>
212
+ <p>Catch Timeout::Error in ModelWatcher.synchronize</p>
213
+ </li></ul>
214
+
215
+ <h3 id="label-0.3.1">0.3.1</h3>
216
+ <ul><li>
217
+ <p>Tuning gargabe collector on ModelWatcher.synchronize</p>
218
+ </li></ul>
219
+
220
+ <h3 id="label-0.3.0">0.3.0</h3>
221
+ <ul><li>
222
+ <p>Added rake task for manual synchronization using ModelWatcher</p>
223
+ </li></ul>
224
+
225
+ <h3 id="label-0.2.17">0.2.17</h3>
226
+ <ul><li>
227
+ <p>Added guard on null #updated_at instances</p>
228
+ </li><li>
229
+ <p>Added ModelWatcher#isimud_sync for manual synchronization</p>
230
+ </li></ul>
231
+
232
+ <h3 id="label-0.2.15">0.2.15</h3>
233
+ <ul><li>
234
+ <p>Changed Event#send to Event#publish, to avoid overloading Ruby.</p>
235
+ </li></ul>
236
+
237
+ <h3 id="label-0.2.13">0.2.13</h3>
238
+ <ul><li>
239
+ <p>Add :omit_parameters option to Event#as_json</p>
240
+ </li></ul>
241
+
242
+ <h3 id="label-0.2.12">0.2.12</h3>
243
+ <ul><li>
244
+ <p>Demodulize ActiveRecord model name when setting ModelWatcher event type</p>
245
+ </li></ul>
246
+
247
+ <h3 id="label-0.2.10">0.2.10</h3>
248
+ <ul><li>
249
+ <p>Added Isimud.retry_failures</p>
250
+ </li><li>
251
+ <p>Isimud::ModelWatcher now includes :created_at and :updated_at columns by
252
+ default</p>
253
+ </li><li>
254
+ <p>Added Isimud::Client.connected?</p>
255
+ </li><li>
256
+ <p>Avoid connecting to database when Isimud::ModelWatcher.watch_attributes is
257
+ called</p>
258
+ </li></ul>
259
+
260
+ <h3 id="label-0.2.4">0.2.4</h3>
261
+ <ul><li>
262
+ <p>Add Isimud::ModelWatcher#isimud_synchronize? to allow conditional
263
+ synchronization. Override to activate.</p>
264
+ </li></ul>
265
+
266
+ <h3 id="label-0.2.2">0.2.2</h3>
267
+ <ul><li>
268
+ <p>Add enable_model_watcher configuration parameter (default is true)</p>
269
+ </li></ul>
270
+
271
+ <h3 id="label-0.2.0">0.2.0</h3>
272
+ <ul><li>
273
+ <p>Added Isimud::Event</p>
274
+ </li><li>
275
+ <p>Extracted Isimud::Client#log into Isimud::Logging module</p>
276
+ </li></ul>
277
+
278
+ <h3 id="label-0.1.4">0.1.4</h3>
279
+ <ul><li>
280
+ <p>Don&#39;t reject messages when exception is raised in bind block</p>
281
+ </li></ul>
282
+
283
+ <h3 id="label-0.1.3">0.1.3</h3>
284
+ <ul><li>
285
+ <p>Upgrade bunny gem requirement to 1.3.x</p>
286
+ </li><li>
287
+ <p>Fixed message acknowledgements</p>
288
+ </li><li>
289
+ <p>Added log_level configuration parameter (default is :debug)</p>
290
+ </li></ul>
291
+
292
+ <h3 id="label-0.1.2">0.1.2</h3>
293
+ <ul><li>
294
+ <p>Reject message with requeue when an exception is raised during processing</p>
295
+ </li></ul>
296
+
297
+ <h3 id="label-0.1.1">0.1.1</h3>
298
+ <ul><li>
299
+ <p>Enable channel confirmations for message publication</p>
300
+ </li></ul>
301
+
302
+ <h3 id="label-0.1.0">0.1.0</h3>
303
+ <ul><li>
304
+ <p>ModelWatcher mix-in for ActiveRecord, sends events on instance changes</p>
305
+ </li><li>
306
+ <p>Initializer generator for Rails</p>
307
+ </li></ul>
308
+
309
+ <h3 id="label-0.0.8+-28first+working+version-29">0.0.8 (first working version)</h3>
310
+ <ul><li>
311
+ <p>Don&#39;t clear the queues when reconnecting TestClient</p>
312
+ </li></ul>
313
+
314
+ <h2 id="label-Contributing">Contributing</h2>
315
+ <ol><li>
316
+ <p>Fork it ( <a
317
+ href="https://github.com/[my-github-username]/isimud/fork">github.com/[my-github-username]/isimud/fork</a>
318
+ )</p>
319
+ </li><li>
320
+ <p>Create your feature branch (<code>git checkout -b my-new-feature</code>)</p>
321
+ </li><li>
322
+ <p>Commit your changes (<code>git commit -am &#39;Add some
323
+ feature&#39;</code>)</p>
324
+ </li><li>
325
+ <p>Push to the branch (<code>git push origin my-new-feature</code>)</p>
326
+ </li><li>
327
+ <p>Create a new Pull Request</p>
328
+ </li></ol>
329
+ </div></div>
330
+
331
+ <div id="footer">
332
+ Generated on Fri Apr 3 09:28:08 2015 by
333
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
334
+ 0.8.7.6 (ruby-2.2.1).
335
+ </div>
336
+
337
+ </body>
338
+ </html>