isimud 1.3.9 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/.yardoc/checksums +0 -15
  5. data/.yardoc/object_types +0 -0
  6. data/.yardoc/objects/root.dat +0 -0
  7. data/Gemfile +2 -2
  8. data/Gemfile.lock +17 -13
  9. data/LICENSE.txt +1 -1
  10. data/README.md +98 -62
  11. data/Rakefile +1 -1
  12. data/checksum/isimud-1.4.0.gem.sha512 +1 -0
  13. data/doc/Isimud.html +118 -138
  14. data/doc/Isimud/BunnyClient.html +2 -2
  15. data/doc/Isimud/Client.html +2 -2
  16. data/doc/Isimud/Event.html +2 -2
  17. data/doc/Isimud/EventListener.html +208 -88
  18. data/doc/Isimud/EventObserver.html +96 -31
  19. data/doc/Isimud/EventObserver/ClassMethods.html +14 -14
  20. data/doc/Isimud/Generators.html +2 -2
  21. data/doc/Isimud/Logging.html +2 -2
  22. data/doc/Isimud/ModelWatcher.html +2 -2
  23. data/doc/Isimud/ModelWatcher/ClassMethods.html +2 -2
  24. data/doc/Isimud/Railtie.html +2 -2
  25. data/doc/Isimud/TestClient.html +2 -2
  26. data/doc/Isimud/TestClient/Queue.html +74 -2
  27. data/doc/_index.html +2 -195
  28. data/doc/class_list.html +1 -1
  29. data/doc/file.LICENSE.html +3 -3
  30. data/doc/file.README.html +157 -65
  31. data/doc/index.html +157 -65
  32. data/doc/method_list.html +0 -732
  33. data/doc/top-level-namespace.html +2 -12
  34. data/lib/isimud.rb +22 -17
  35. data/lib/isimud/bunny_client.rb +12 -10
  36. data/lib/isimud/client.rb +10 -1
  37. data/lib/isimud/event_listener.rb +6 -6
  38. data/lib/isimud/test_client.rb +12 -12
  39. data/lib/isimud/version.rb +1 -1
  40. data/release +1 -1
  41. data/spec/isimud/bunny_client_spec.rb +28 -27
  42. data/spec/isimud/client_spec.rb +50 -5
  43. metadata +3 -4
  44. metadata.gz.sig +0 -0
  45. data/doc/Isimud/Generators/ConfigGenerator.html +0 -192
  46. data/doc/Isimud/Generators/InitializerGenerator.html +0 -192
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fbd377e53c6aa832554fbcaa4770094f17b35a98
4
- data.tar.gz: 1d691b4c2711105f558af95cc19115aadff8a621
3
+ metadata.gz: 4e44d23a18cf13265519e1f9141b7548ef1a3974
4
+ data.tar.gz: 11817dccd7145d8b56596836cbb214d2801cf549
5
5
  SHA512:
6
- metadata.gz: b8b812abc5bbf09afea8d6c79dee53521aca81a97e1df007f18eaeb2d5189d7bc64978d6e9ebc97dc66639b1cd081c95cf2044364a056151f014e95c95ffc3f4
7
- data.tar.gz: 4c4a173be7017d1458f6d491d6e9bdb040d22a4e80ceeaa0ce347451165865aaf03609aae45db0fb9ca0af1689fe4bde5170cb17ae1f4ee3c37f966023f4d160
6
+ metadata.gz: 718764a123733b2e68180f965a33aa49e5d9d5e6ac7debb7c7914b3ef406ba75aa62a9acf3c7bb54840249992a291add6c2252b755b7e2f82c8d33d26ef69a22
7
+ data.tar.gz: c78ec602bf966b51015cb611d647ff793afa2a2ff162e11dcd0fcb4f660b6c3f63dc127f724c8948dc346f6052dac7ad6a7543feba07c7ffa349b8335b4762d3
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,15 +0,0 @@
1
- lib/isimud.rb 5a9fee170ff924c6347d98fb5a80980d5f0ecc9a
2
- lib/isimud/event.rb f29a804bfa084e68329825b5fb9863d268f3ff27
3
- lib/isimud/tasks.rb 8d07d80e178928098e959ebdcbda1707e9b50617
4
- lib/isimud/client.rb 88ffac5ff4cc3306d0f1c9f9a1ca9d5c344e81cf
5
- lib/isimud/version.rb 3c726b1fa933bfa72e64a8c111f741f10a0a8220
6
- lib/isimud/logging.rb 2f506f049011441628a3d573d8e2a670156b4a3a
7
- lib/isimud/railtie.rb e644c4d74ae8298f11dd0c2fcae1d72259e24ea3
8
- lib/isimud/test_client.rb e70e3b96b7cec013f8edcb4005ea72ea8acc48c7
9
- lib/isimud/bunny_client.rb 7009922019087e2c9920073cb79c93aba8446dc4
10
- lib/isimud/model_watcher.rb f6694603386e538f755ff7217f975f04c9529c26
11
- lib/isimud/event_observer.rb 64c3af1d81df6a97cf9700eb71dc4d241f5b0044
12
- lib/isimud/event_listener.rb e7fea6bb36d76bc50c28c32869653d0558a3e7f7
13
- lib/rails/generators/isimud/config_generator.rb d1c964f26c6e0f0289343bac17d3a9b1f99d7a98
14
- lib/rails/generators/isimud/initializer_generator.rb c7b188459d17d35ccbfa820a434dd6a97a58aeeb
15
- lib/rails/generators/isimud/templates/initializer.rb 6b937955296d704bfa4a06eec91ce14a6dd954ba
Binary file
Binary file
data/Gemfile CHANGED
@@ -11,11 +11,11 @@ gem 'yard'
11
11
 
12
12
  group :development, :test do
13
13
  gem 'awesome_print'
14
- gem 'rspec'
14
+ gem 'rspec-rails'
15
15
  gem 'combustion'
16
16
  gem 'database_cleaner'
17
17
  gem 'sqlite3'
18
- gem 'codeclimate-test-reporter', require: false
18
+ gem 'codeclimate-test-reporter', require: nil
19
19
  end
20
20
 
21
21
  group :test do
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- isimud (1.3.9)
4
+ isimud (1.4.0)
5
5
  activerecord (>= 4.1.4)
6
6
  activesupport (>= 4.1.4)
7
7
  bunny (>= 1.6.0)
@@ -64,19 +64,23 @@ GEM
64
64
  rake (>= 0.8.7)
65
65
  thor (>= 0.18.1, < 2.0)
66
66
  rake (10.4.2)
67
- rspec (3.3.0)
68
- rspec-core (~> 3.3.0)
69
- rspec-expectations (~> 3.3.0)
70
- rspec-mocks (~> 3.3.0)
71
- rspec-core (3.3.2)
72
- rspec-support (~> 3.3.0)
73
- rspec-expectations (3.3.1)
67
+ rspec-core (3.5.1)
68
+ rspec-support (~> 3.5.0)
69
+ rspec-expectations (3.5.0)
74
70
  diff-lcs (>= 1.2.0, < 2.0)
75
- rspec-support (~> 3.3.0)
76
- rspec-mocks (3.3.2)
71
+ rspec-support (~> 3.5.0)
72
+ rspec-mocks (3.5.0)
77
73
  diff-lcs (>= 1.2.0, < 2.0)
78
- rspec-support (~> 3.3.0)
79
- rspec-support (3.3.0)
74
+ rspec-support (~> 3.5.0)
75
+ rspec-rails (3.5.1)
76
+ actionpack (>= 3.0)
77
+ activesupport (>= 3.0)
78
+ railties (>= 3.0)
79
+ rspec-core (~> 3.5.0)
80
+ rspec-expectations (~> 3.5.0)
81
+ rspec-mocks (~> 3.5.0)
82
+ rspec-support (~> 3.5.0)
83
+ rspec-support (3.5.0)
80
84
  simplecov (0.10.0)
81
85
  docile (~> 1.1.0)
82
86
  json (~> 1.8)
@@ -105,7 +109,7 @@ DEPENDENCIES
105
109
  database_cleaner
106
110
  isimud!
107
111
  rake
108
- rspec
112
+ rspec-rails
109
113
  sqlite3
110
114
  test_after_commit
111
115
  timecop
@@ -1,4 +1,4 @@
1
- Copyright (c) 2016 Keas Inc.
1
+ Copyright (c) 2016 Welltok Inc.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -15,7 +15,7 @@ Isimud is an AMQP message publishing and consumption gem intended for Rails appl
15
15
  * An Event Listener daemon process which manages queues and dispatches messages for Event Observers.
16
16
  * A test client for mocking message publication, allowing synchronous delivery and processing of messages in unit tests.
17
17
 
18
- ## Installation
18
+ # Installation
19
19
 
20
20
  Add this line to your application's Gemfile:
21
21
 
@@ -36,17 +36,17 @@ For Rails applications, use the following generators to create config and initia
36
36
 
37
37
  Customize the AMQP broker settings in the config/isimud.yml
38
38
 
39
- ## Usage
39
+ # Usage
40
40
 
41
- ### Connecting to an AMQP server
41
+ ## Connecting to an AMQP Server
42
42
 
43
43
  There are two supported conventions for specifying a RabbitMQ server (broker) in the configuration file:
44
44
 
45
- #### Using a URL
45
+ ### Using a URL
46
46
 
47
47
  server: amqp:port//user_name:password@host/vhost
48
48
 
49
- #### Using separate parameters:
49
+ ### Using Separate Parameters:
50
50
 
51
51
  server:
52
52
  host: hostname
@@ -67,57 +67,98 @@ in order to prevent loss of messages due to failures.
67
67
 
68
68
  Isimud uses [Bunny](http://rubybunny.info) to connect to RabbitMQ.
69
69
 
70
- ### Message publication
70
+ ## Message Publication
71
71
 
72
- Isimud uses topic based exchanges publish messages. This allows for multiple listener
73
- workers to operate in parallel to process messages.
72
+ Isimud publish messages to topic based exchanges. Each message is tagged with a routing key, allowing for multiple
73
+ audiences to selectively receive messages.
74
74
 
75
- ### Message binding and consumption
75
+ ## Message Queues, Bindings, and Consumption
76
76
 
77
- Isimud uses non-exclusive, durable queues to listen for and consume messages. Named queues are automatically created
78
- if they do not exist.
77
+ Isimud uses named, non-exclusive, durable queues to consume messages, with a configurable pre-fetch amount.
79
78
 
80
- ## Changes
79
+ There are two ways that message queues may be declared:
81
80
 
82
- ### 1.3.9
81
+ 1. Using EventObserver instances. The EventObserver module allows an implementing class to define queues and bindings
82
+ for each instance.
83
+ * The EventListener automatically establishes and manages queues for instances of each implementing class.
84
+ * Each EventListener process maintains its own exclusive queue to automatically add or cancel consumers for
85
+ EventObserver instances as they added, modified, or deleted.
86
+ 2. Custom standalone queues. You may extend EventListener to declare individual queues not associated with a specific
87
+ object instance.
83
88
 
84
- * EventListener changes:
85
- * start_event_thread, dump exception backtrace to log
86
- * set log level to info or higher for all event thread messages
89
+ The EventListener process will automatically create queues on initial startup if they do not already exist. This allows
90
+ for cold startup on a new AMQP broker.
87
91
 
88
- ### 1.3.8
92
+ ### Message Delivery Information and Metadata
93
+
94
+ Each time that a message is retrieved from the queue, the following properties are set in the current thread:
95
+
96
+ | name | contents |
97
+ | ---- | -------- |
98
+ | isimud_queue_name | Name of the queue processing the thread |
99
+ | isimud_delivery_info | Message delivery information (*Bunny::DeliveryInfo*) |
100
+ | isimud_properties | Message properties metadata (*Bunny::MessageProperties*) |
101
+
102
+ ### Exception Handling
103
+
104
+ If an uncaught instance of StandardError is raised during message processing, all exception handlers added to the
105
+ client are run in the order they were declared (see Client#on_exception). Any exceptions raised by the exception
106
+ handlers themselves are silently ignored.
107
+
108
+ You can configure the disposition of the message that triggered the exception using the configuration attribute
109
+ Isimud.retry_failures as follows:
110
+
111
+ | Isimud.retry_failures | Behavior |
112
+ | :-------------------: | -------- |
113
+ | *false* | Never requeue messages (default) |
114
+ | *true* | Always requeue messages |
115
+ | *nil* | Conditionally re-queue messages based on exception handler return values |
116
+
117
+ When conditional re-queueing is enabled, requeue is determined based on the return value of all exception handlers,
118
+ logically AND-ed. If the result is truthy, the message is re-queued. If the return value of any handler is falsey,
119
+ the message is not re-queued.
120
+
121
+ # Changes
122
+
123
+ ## 1.4.1
124
+
125
+ * Enable conditional re-queuing of messages after an exception is raised (see *Exception Handling* above).
126
+ * Log messages for receipt and ack of messages downgraded to debug level.
127
+ * Force manual_ack mode for all queue subscriptions.
128
+
129
+ ## 1.3.8
89
130
 
90
131
  * In EventListener event thread, rescue all exceptions, not just Bunny ones.
91
132
 
92
- ### 1.3.7
133
+ ## 1.3.7
93
134
 
94
135
  * Change instance var 'status' inside the start event thread
95
136
 
96
- ### 1.3.6
137
+ ## 1.3.6
97
138
 
98
139
  * Don't include ModelWatcher attributes in event publish log message
99
140
  * Include routing key in ModelWatcher event publish log message
100
141
 
101
- ### 1.3.5
142
+ ## 1.3.5
102
143
 
103
144
  * Added option to EventObserver#observe_events to recreate bindings for observer queues
104
145
  * EventListener only create bindings and queues for EventObserver instances on initial startup
105
146
 
106
- ### 1.3.4
147
+ ## 1.3.4
107
148
 
108
149
  * Always recreate bindings for observer queues when EventListener starts the event thread.
109
150
  * Cleaned up method signature on EventObserver#delete_queue so that a client may be passed to it.
110
151
 
111
- ### 1.3.3
152
+ ## 1.3.3
112
153
 
113
154
  * Fixed handling of exceptions in TestClient
114
155
  * Make EventListener#has_observer? public
115
156
 
116
- ### 1.3.1
157
+ ## 1.3.1
117
158
 
118
159
  * Add EventObserver#deactivate_observer to trigger queue deletion for an observer instance.
119
160
 
120
- ### 1.3.0
161
+ ## 1.3.0
121
162
 
122
163
  * Added a new method, EventListener#bind_event_queues() for registering custom event handlers. Override
123
164
  this method instead of bind_queues() to bind custom queues not handled by EventObserver instances.
@@ -125,27 +166,27 @@ if they do not exist.
125
166
  hosts sharing the same PID.
126
167
  * Added lots of documentation.
127
168
 
128
- ### 1.2.1
169
+ ## 1.2.1
129
170
 
130
171
  * Include attributes in ModelWatcher destroy message
131
172
 
132
- ### 1.2.0
173
+ ## 1.2.0
133
174
 
134
175
  * EventObserver#update_queue now always binds current routing keys. This ensures that when an enable_listener? changes
135
176
  state from false to true during an update, all bindings for the queue are established.
136
177
  * Add EventObserver#activate_observer(), which creates and binds a queue for an observer instance on demand.
137
178
  * Add declaration for Client#find_queue, and normalize the method signature for subclasses.
138
179
 
139
- ### 1.1.0
180
+ ## 1.1.0
140
181
 
141
182
  * Clients now support multiple exception handlers. Each call to Client#on_exception will add a new block to the
142
183
  exception handlers list
143
184
 
144
- ### 1.0.2
185
+ ## 1.0.2
145
186
 
146
- #### Breaking Changes:
187
+ ### Breaking Changes:
147
188
 
148
- * EventObserver instances are now required to have the persistent attribute /exchange_routing_keys/. These are used to
189
+ * EventObserver instances are now required to have the persistent attribute *exchange_routing_keys*. These are used to
149
190
  store the current value of routing keys assoicated with an instance. The queue associated with an EventObserver is
150
191
  now created and updated at the same time the EventObserver is updated, rather than relying on the EventListener to
151
192
  create it.
@@ -156,7 +197,7 @@ if they do not exist.
156
197
  * Client#create_queue no longer accepts a block parameter and does not subscribe to messages.
157
198
  * Removed Client#rebind.
158
199
 
159
- #### Other Changes:
200
+ ### Other Changes:
160
201
 
161
202
  * TestClient::Queue now responds to bind() and unbind() in the same manner as Bunny::Queue.
162
203
  * BunnyClient#create_queue now may be called without a block to instantiate an AMQP queue without subscribing to messages
@@ -164,16 +205,16 @@ if they do not exist.
164
205
  * Changed BunnyClient#delete_queue to make it more reliable.
165
206
  * EventListener now uses a shared, durable queue for monitoring events on modified EventObserver instances.
166
207
 
167
- ### 0.5.2
208
+ ## 0.5.2
168
209
 
169
210
  * Fixed regexp bug in TestClient affecting message delivery
170
211
  * Add more logging for EventObserver binding
171
212
 
172
- ### 0.5.1
213
+ ## 0.5.1
173
214
 
174
215
  * Added Event#attributes
175
216
 
176
- ### 0.5.0
217
+ ## 0.5.0
177
218
 
178
219
  * Allow EventObserver classes to override the exchange for listening to events
179
220
  * Corrected initialization of EventListener for handling defaults
@@ -181,23 +222,23 @@ if they do not exist.
181
222
  * Fixed a bug in EventObserver that caused ModelWatcher to not send update events appropriately when default columns are watched
182
223
  * Moved requires for Isimud below config attribute declarations
183
224
 
184
- ### 0.4.10
225
+ ## 0.4.10
185
226
 
186
227
  * Corrected trap of INT and TERM signals
187
228
  * Added error counter mutex and cleaned up logging
188
229
  * Corrected race condition for registering EventObserver classes
189
230
 
190
- ### 0.4.5
231
+ ## 0.4.5
191
232
 
192
233
  * Fixed issues with exception handling
193
234
 
194
- ### 0.4.1
235
+ ## 0.4.1
195
236
 
196
237
  * Event now accepts an exchange option for publishing
197
238
  * Added Isimud.events_exchange
198
239
  * Cleaned up initializer template
199
240
 
200
- ### 0.4.0
241
+ ## 0.4.0
201
242
 
202
243
  * Event logging of published message now set to debug level
203
244
  * Added EventListener and EventObserver
@@ -206,96 +247,91 @@ if they do not exist.
206
247
  * Clients can now be configured with an exception handler. This is used by EventListener to intercept exceptions raised
207
248
  during message handling by an observer.
208
249
 
209
- ### 0.3.7
250
+ ## 0.3.7
210
251
 
211
252
  * Added EventObserver mix-in
212
253
  * Added accessors for queues and routing_keys to TestClient
213
254
 
214
- ### 0.3.6
255
+ ## 0.3.6
215
256
 
216
257
  * Reraise all exceptions in message processing block in BunnyClient#bind.
217
258
 
218
- ### 0.3.5
259
+ ## 0.3.5
219
260
 
220
261
  * Fixed deprecation on setting manual ack on Bunny queue subscriptions.
221
262
 
222
- ### 0.3.4
263
+ ## 0.3.4
223
264
 
224
265
  * Catch Timeout::Error in ModelWatcher.synchronize
225
266
 
226
- ### 0.3.1
267
+ ## 0.3.1
227
268
 
228
269
  * Tuning gargabe collector on ModelWatcher.synchronize
229
270
 
230
- ### 0.3.0
271
+ ## 0.3.0
231
272
 
232
273
  * Added rake task for manual synchronization using ModelWatcher
233
274
 
234
- ### 0.2.17
275
+ ## 0.2.17
235
276
 
236
277
  * Added guard on null #updated_at instances
237
278
  * Added ModelWatcher#isimud_sync for manual synchronization
238
279
 
239
- ### 0.2.15
280
+ ## 0.2.15
240
281
 
241
282
  * Changed Event#send to Event#publish, to avoid overloading Ruby.
242
283
 
243
- ### 0.2.13
284
+ ## 0.2.13
244
285
 
245
286
  * Add :omit_parameters option to Event#as_json
246
287
 
247
- ### 0.2.12
288
+ ## 0.2.12
248
289
 
249
290
  * Demodulize ActiveRecord model name when setting ModelWatcher event type
250
291
 
251
- ### 0.2.10
292
+ ## 0.2.10
252
293
 
253
294
  * Added Isimud.retry_failures
254
295
  * Isimud::ModelWatcher now includes :created_at and :updated_at columns by default
255
296
  * Added Isimud::Client.connected?
256
297
  * Avoid connecting to database when Isimud::ModelWatcher.watch_attributes is called
257
298
 
258
- ### 0.2.4
299
+ ## 0.2.4
259
300
 
260
301
  * Add Isimud::ModelWatcher#isimud_synchronize? to allow conditional synchronization. Override to activate.
261
302
 
262
- ### 0.2.2
303
+ ## 0.2.2
263
304
 
264
305
  * Add enable_model_watcher configuration parameter (default is true)
265
306
 
266
- ### 0.2.0
307
+ ## 0.2.0
267
308
 
268
309
  * Added Isimud::Event
269
310
  * Extracted Isimud::Client#log into Isimud::Logging module
270
311
 
271
- ### 0.1.4
312
+ ## 0.1.4
272
313
 
273
314
  * Don't reject messages when exception is raised in bind block
274
315
 
275
- ### 0.1.3
316
+ ## 0.1.3
276
317
 
277
318
  * Upgrade bunny gem requirement to 1.3.x
278
319
  * Fixed message acknowledgements
279
320
  * Added log_level configuration parameter (default is :debug)
280
321
 
281
- ### 0.1.2
322
+ ## 0.1.2
282
323
 
283
324
  * Reject message with requeue when an exception is raised during processing
284
325
 
285
- ### 0.1.1
326
+ ## 0.1.1
286
327
 
287
328
  * Enable channel confirmations for message publication
288
329
 
289
- ### 0.1.0
330
+ ## 0.1.0
290
331
 
291
332
  * ModelWatcher mix-in for ActiveRecord, sends events on instance changes
292
333
  * Initializer generator for Rails
293
334
 
294
- ### 0.0.8 (first working version)
295
-
296
- * Don't clear the queues when reconnecting TestClient
297
-
298
-
299
335
  ## Contributing
300
336
 
301
337
  1. Fork it ( https://github.com/KeasInc/isimud/fork )