isimud 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d00087ddb9c814123247016a8369c981460dd5fe
4
- data.tar.gz: 08af358a3d6b7095c7612ac524ac3d02f82b42d0
3
+ metadata.gz: 24e6e7c078fcbde044973d789c6864ad9d2f135d
4
+ data.tar.gz: d360568fc6f12868894f4e7ea73326588e2d54fd
5
5
  SHA512:
6
- metadata.gz: b13ddd2631d2f5354489b69aa1ad1e2dfffe2a1ab680f0c5ddffc37bdbe2cc05a9a32aeb40fbc8dc3c3e7e3fdbeec764e5920bc4b9d8e2a075467e4716f41bf0
7
- data.tar.gz: 242fb5bca098a9f563d3a87b6b0dc26cebc868d86486af7d479ba23bac9cf06d87b2062363df5a4683aaa1ece0e288edba1f4a058234a2f889c57e13f21a90d7
6
+ metadata.gz: 4ccb82c28094f8c9c11c65c2f28a323f9537a521753f93ecc5018b9cc9c893d2fba136020e714017f3e1bce93dd15253097ece8e1dab61b139694a18891c3188
7
+ data.tar.gz: 1b1b713a107beca0d3b318bdf042bf7b7490d19570eddf4a479ad98b69f365f883f6085fd8f9d22d0a527a6af2dc782a4f6fe1f544f094722860fd59b7fb73de
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- isimud (1.4.2)
4
+ isimud (1.4.3)
5
5
  activerecord (>= 4.1.4)
6
6
  activesupport (>= 4.1.4)
7
7
  bunny (>= 1.6.0)
data/README.md CHANGED
@@ -93,11 +93,11 @@ for cold startup on a new AMQP broker.
93
93
 
94
94
  Each time that a message is retrieved from the queue, the following properties are set in the current thread:
95
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*) |
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
101
 
102
102
  ### Exception Handling
103
103
 
@@ -120,6 +120,11 @@ the message is not re-queued.
120
120
 
121
121
  # Changes
122
122
 
123
+ ## 1.4.3
124
+
125
+ * When an exception is raised during message processing, check status of channel before calling reject()
126
+ * Symbolize keys in options when initializing BunnyClient
127
+
123
128
  ## 1.4.2
124
129
 
125
130
  * BunnyClient#publish now accepts additional metadata options
@@ -134,6 +139,12 @@ the message is not re-queued.
134
139
  * Log messages for receipt and ack of messages downgraded to debug level.
135
140
  * Force manual_ack mode for all queue subscriptions.
136
141
 
142
+ ## 1.3.9
143
+
144
+ * EventListener changes:
145
+ * start_event_thread, dump exception backtrace to log
146
+ * set log level to info or higher for all event thread messages
147
+
137
148
  ## 1.3.8
138
149
 
139
150
  * In EventListener event thread, rescue all exceptions, not just Bunny ones.
@@ -0,0 +1 @@
1
+ e4a69fdd34af13d8dc4363f6f50ac5ea7b3b0eda113977da90ce1f1a5c02a43dba63981b079208c15c92a776546f13307530f527f3b744f74e3bbaab31a2a119
data/doc/_index.html CHANGED
@@ -91,7 +91,7 @@
91
91
  </div>
92
92
 
93
93
  <div id="footer">
94
- Generated on Wed Aug 24 20:16:22 2016 by
94
+ Generated on Fri Sep 16 16:32:29 2016 by
95
95
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
96
96
  0.8.7.6 (ruby-2.3.0).
97
97
  </div>
@@ -64,7 +64,7 @@
64
64
  <div id="content"><div id='filecontents'>Copyright (c) 2016 Welltok Inc.<br/><br/>Permission is hereby granted, free of charge, to any person obtaining a copy<br/>of this software and associated documentation files (the &quot;Software&quot;), to deal<br/>in the Software without restriction, including without limitation the rights<br/>to use, copy, modify, merge, publish, distribute, sublicense, and/or sell<br/>copies of the Software, and to permit persons to whom the Software is<br/>furnished to do so, subject to the following conditions:<br/><br/>The above copyright notice and this permission notice shall be included in all<br/>copies or substantial portions of the Software.<br/><br/>THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br/>IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br/>FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE<br/>AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br/>LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,<br/>OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE<br/>SOFTWARE.</div></div>
65
65
 
66
66
  <div id="footer">
67
- Generated on Wed Aug 24 20:16:23 2016 by
67
+ Generated on Fri Sep 16 16:32:31 2016 by
68
68
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
69
69
  0.8.7.6 (ruby-2.3.0).
70
70
  </div>
data/doc/file.README.html CHANGED
@@ -189,9 +189,9 @@ AMQP broker.</p>
189
189
  <p>Each time that a message is retrieved from the queue, the following
190
190
  properties are set in the current thread:</p>
191
191
 
192
- <p>| name | contents | | —- | ——– | | isimud_queue_name | Name of the queue
193
- processing the thread | | isimud_delivery_info | Message delivery
194
- information (<em>Bunny::DeliveryInfo</em>) | | isimud_properties | Message
192
+ <p>| name | contents | | —- | ——– | | isimud_queue_name | Name of the queue
193
+ processing the thread | | isimud_delivery_info | Message delivery
194
+ information (<em>Bunny::DeliveryInfo</em>) | | isimud_properties | Message
195
195
  properties metadata (<em>Bunny::MessageProperties</em>) |</p>
196
196
 
197
197
  <h3 id="label-Exception+Handling">Exception Handling</h3>
@@ -217,16 +217,44 @@ falsey, the message is not re-queued.</p>
217
217
 
218
218
  <h1 id="label-Changes">Changes</h1>
219
219
 
220
+ <h2 id="label-1.4.3">1.4.3</h2>
221
+ <ul><li>
222
+ <p>When an exception is raised during message processing, check status of
223
+ channel before calling reject()</p>
224
+ </li><li>
225
+ <p>Symbolize keys in options when initializing BunnyClient</p>
226
+ </li></ul>
227
+
220
228
  <h2 id="label-1.4.2">1.4.2</h2>
221
229
  <ul><li>
230
+ <p>BunnyClient#publish now accepts additional metadata options</p>
231
+ </li><li>
232
+ <p>Isimud::Event changes:</p>
233
+ </li><li>
234
+ <p>Added #timestamp property</p>
235
+ </li><li>
236
+ <p>Added #message_id for generating unique message IDs</p>
237
+ </li><li>
238
+ <p>message_id is now added to metadata when publishing</p>
239
+ </li></ul>
240
+
241
+ <h2 id="label-1.4.1">1.4.1</h2>
242
+ <ul><li>
222
243
  <p>Enable conditional re-queuing of messages after an exception is raised (see
223
244
  <em>Exception Handling</em> above).</p>
224
245
  </li><li>
225
246
  <p>Log messages for receipt and ack of messages downgraded to debug level.</p>
226
247
  </li><li>
227
248
  <p>Force manual_ack mode for all queue subscriptions.</p>
249
+ </li></ul>
250
+
251
+ <h2 id="label-1.3.9">1.3.9</h2>
252
+ <ul><li>
253
+ <p>EventListener changes:</p>
254
+ </li><li>
255
+ <p>start_event_thread, dump exception backtrace to log</p>
228
256
  </li><li>
229
- <p>BunnyClient#publish now accepts additional</p>
257
+ <p>set log level to info or higher for all event thread messages</p>
230
258
  </li></ul>
231
259
 
232
260
  <h2 id="label-1.3.8">1.3.8</h2>
@@ -554,7 +582,7 @@ feature&#39;</code>)</p>
554
582
  </div></div>
555
583
 
556
584
  <div id="footer">
557
- Generated on Wed Aug 24 20:16:23 2016 by
585
+ Generated on Fri Sep 16 16:32:31 2016 by
558
586
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
559
587
  0.8.7.6 (ruby-2.3.0).
560
588
  </div>
data/doc/index.html CHANGED
@@ -189,9 +189,9 @@ AMQP broker.</p>
189
189
  <p>Each time that a message is retrieved from the queue, the following
190
190
  properties are set in the current thread:</p>
191
191
 
192
- <p>| name | contents | | —- | ——– | | isimud_queue_name | Name of the queue
193
- processing the thread | | isimud_delivery_info | Message delivery
194
- information (<em>Bunny::DeliveryInfo</em>) | | isimud_properties | Message
192
+ <p>| name | contents | | —- | ——– | | isimud_queue_name | Name of the queue
193
+ processing the thread | | isimud_delivery_info | Message delivery
194
+ information (<em>Bunny::DeliveryInfo</em>) | | isimud_properties | Message
195
195
  properties metadata (<em>Bunny::MessageProperties</em>) |</p>
196
196
 
197
197
  <h3 id="label-Exception+Handling">Exception Handling</h3>
@@ -217,16 +217,44 @@ falsey, the message is not re-queued.</p>
217
217
 
218
218
  <h1 id="label-Changes">Changes</h1>
219
219
 
220
+ <h2 id="label-1.4.3">1.4.3</h2>
221
+ <ul><li>
222
+ <p>When an exception is raised during message processing, check status of
223
+ channel before calling reject()</p>
224
+ </li><li>
225
+ <p>Symbolize keys in options when initializing BunnyClient</p>
226
+ </li></ul>
227
+
220
228
  <h2 id="label-1.4.2">1.4.2</h2>
221
229
  <ul><li>
230
+ <p>BunnyClient#publish now accepts additional metadata options</p>
231
+ </li><li>
232
+ <p>Isimud::Event changes:</p>
233
+ </li><li>
234
+ <p>Added #timestamp property</p>
235
+ </li><li>
236
+ <p>Added #message_id for generating unique message IDs</p>
237
+ </li><li>
238
+ <p>message_id is now added to metadata when publishing</p>
239
+ </li></ul>
240
+
241
+ <h2 id="label-1.4.1">1.4.1</h2>
242
+ <ul><li>
222
243
  <p>Enable conditional re-queuing of messages after an exception is raised (see
223
244
  <em>Exception Handling</em> above).</p>
224
245
  </li><li>
225
246
  <p>Log messages for receipt and ack of messages downgraded to debug level.</p>
226
247
  </li><li>
227
248
  <p>Force manual_ack mode for all queue subscriptions.</p>
249
+ </li></ul>
250
+
251
+ <h2 id="label-1.3.9">1.3.9</h2>
252
+ <ul><li>
253
+ <p>EventListener changes:</p>
254
+ </li><li>
255
+ <p>start_event_thread, dump exception backtrace to log</p>
228
256
  </li><li>
229
- <p>BunnyClient#publish now accepts additional</p>
257
+ <p>set log level to info or higher for all event thread messages</p>
230
258
  </li></ul>
231
259
 
232
260
  <h2 id="label-1.3.8">1.3.8</h2>
@@ -554,7 +582,7 @@ feature&#39;</code>)</p>
554
582
  </div></div>
555
583
 
556
584
  <div id="footer">
557
- Generated on Wed Aug 24 20:16:23 2016 by
585
+ Generated on Fri Sep 16 16:32:30 2016 by
558
586
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
559
587
  0.8.7.6 (ruby-2.3.0).
560
588
  </div>
@@ -93,7 +93,7 @@
93
93
  </div>
94
94
 
95
95
  <div id="footer">
96
- Generated on Wed Aug 24 20:16:23 2016 by
96
+ Generated on Fri Sep 16 16:32:31 2016 by
97
97
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
98
98
  0.8.7.6 (ruby-2.3.0).
99
99
  </div>
@@ -18,7 +18,8 @@ module Isimud
18
18
  def initialize(_url = nil, _bunny_options = {})
19
19
  log "Isimud::BunnyClient.initialize: options = #{_bunny_options.inspect}"
20
20
  @url = _url || DEFAULT_URL
21
- @bunny_options = _bunny_options
21
+ @url.symbolize_keys! if @url.respond_to?(:symbolize_keys!)
22
+ @bunny_options = _bunny_options.symbolize_keys
22
23
  end
23
24
 
24
25
  # Convenience method that finds or creates a named queue, binds to an exchange, and subscribes to messages.
@@ -68,18 +69,18 @@ module Isimud
68
69
  queue.subscribe(options.merge(manual_ack: true)) do |delivery_info, properties, payload|
69
70
  current_channel = channel
70
71
  begin
71
- log "Isimud: queue #{queue.name} received #{delivery_info.delivery_tag} routing_key: #{delivery_info.routing_key}", :debug
72
+ log "Isimud: queue #{queue.name} received #{properties[:message_id]} routing_key: #{delivery_info.routing_key}", :debug
72
73
  Thread.current['isimud_queue_name'] = queue.name
73
74
  Thread.current['isimud_delivery_info'] = delivery_info
74
75
  Thread.current['isimud_properties'] = properties
75
76
  block.call(payload)
76
- log "Isimud: queue #{queue.name} finished with #{delivery_info.delivery_tag}, acknowledging", :debug
77
+ log "Isimud: queue #{queue.name} finished with #{properties[:message_id]}, acknowledging", :debug
77
78
  current_channel.ack(delivery_info.delivery_tag)
78
79
  rescue => e
79
- log("Isimud: queue #{queue.name} error processing #{delivery_info.delivery_tag} payload #{payload.inspect}: #{e.class.name} #{e.message}\n #{e.backtrace.join("\n ")}", :warn)
80
+ log("Isimud: queue #{queue.name} error processing #{properties[:message_id]} payload #{payload.inspect}: #{e.class.name} #{e.message}\n #{e.backtrace.join("\n ")}", :warn)
80
81
  retry_status = run_exception_handlers(e)
81
- log "Isimud: rejecting #{delivery_info.delivery_tag} requeue=#{retry_status}", :warn
82
- current_channel.reject(delivery_info.delivery_tag, retry_status)
82
+ log "Isimud: rejecting #{properties[:message_id]} requeue=#{retry_status}", :warn
83
+ current_channel.open? && current_channel.reject(delivery_info.delivery_tag, retry_status)
83
84
  end
84
85
  end
85
86
  end
@@ -84,8 +84,8 @@ module Isimud
84
84
  @events_exchange = options[:events_exchange]
85
85
  @models_exchange = options[:models_exchange]
86
86
  @name = options[:name]
87
- @observer_mutex = Mutex.new
88
- @error_counter_mutex = Mutex.new
87
+ @observer_mutex = Thread::Mutex.new
88
+ @error_counter_mutex = Thread::Mutex.new
89
89
  @status = STATUS_INITIALIZE
90
90
  end
91
91
 
@@ -171,16 +171,16 @@ module Isimud
171
171
 
172
172
  def start_event_thread
173
173
  Thread.new do
174
- log 'EventListener: starting event_thread'
174
+ log 'EventListener: starting event_thread', :info
175
175
  until shutdown? do
176
176
  begin
177
177
  bind_queues
178
- log 'EventListener: event_thread finished'
178
+ log 'EventListener: event_thread bind_queues finished', :info
179
179
  @status = STATUS_RUNNING
180
180
  Thread.stop
181
181
  rescue => e
182
+ log "EventListener: error in event thread: #{e.message}\n #{e.backtrace.join("\n ")}", :warn
182
183
  count_error(e)
183
- log 'EventListener: resetting queues', :warn
184
184
  @observer_queue = nil
185
185
  client.reset
186
186
  end
@@ -201,7 +201,7 @@ module Isimud
201
201
  end
202
202
 
203
203
  def start_error_counter_thread
204
- log 'EventListener: starting error counter'
204
+ log 'EventListener: starting error counter', :info
205
205
  @error_count = 0
206
206
  Thread.new do
207
207
  while true
@@ -1,3 +1,3 @@
1
1
  module Isimud
2
- VERSION = '1.4.2'
2
+ VERSION = '1.4.3'
3
3
  end
@@ -1,14 +1,24 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Isimud::BunnyClient do
4
- let!(:exchange_name) { 'isimud_test' }
5
- let!(:url) { 'amqp://guest:guest@localhost' }
6
- let!(:client) { Isimud::BunnyClient.new(url) }
7
- let!(:connection) { client.connection }
4
+ let(:exchange_name) { 'isimud_test' }
5
+ let(:url) { 'amqp://guest:guest@localhost' }
6
+ let(:client) { Isimud::BunnyClient.new(url) }
7
+ let(:connection) { client.connection }
8
8
 
9
9
  describe '#initialize' do
10
- it 'sets the broker URL' do
11
- expect(client.url).to eq(url)
10
+ context 'with a string URL' do
11
+ it 'sets the broker URL' do
12
+ expect(client.url).to eq(url)
13
+ end
14
+ end
15
+
16
+ context 'with a server specified as a hash' do
17
+ let(:options) { {host: 'foo@example.com', port: 15671, user: 'user', password: 'secret'} }
18
+ let(:url) { options.stringify_keys }
19
+ it 'symbolizes the keys and passes the hash' do
20
+ expect(client.url).to eql(options)
21
+ end
12
22
  end
13
23
  end
14
24
 
@@ -113,6 +123,7 @@ describe Isimud::BunnyClient do
113
123
 
114
124
  describe '#connected?' do
115
125
  it 'is true for an open session' do
126
+ channel = client.connect
116
127
  expect(client).to be_connected
117
128
  end
118
129
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isimud
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - George Feil
@@ -31,7 +31,7 @@ cert_chain:
31
31
  wSKk31gq6KY7rgi11mcLvVzwSuwZFqnonAmu/uin3cbXcOUkqNsyzZ0LQLXNKiwi
32
32
  k0RgrsSNtQ8hcsVSQla0Ot+X3WpFI4ZuIfSLFA==
33
33
  -----END CERTIFICATE-----
34
- date: 2016-08-25 00:00:00.000000000 Z
34
+ date: 2016-09-16 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: activerecord
@@ -116,6 +116,7 @@ files:
116
116
  - checksum/isimud-1.3.8.gem.sha512
117
117
  - checksum/isimud-1.4.0.gem.sha512
118
118
  - checksum/isimud-1.4.1.gem.sha512
119
+ - checksum/isimud-1.4.2.gem.sha512
119
120
  - config.ru
120
121
  - config/tddium.yml
121
122
  - doc/Isimud.html
metadata.gz.sig CHANGED
Binary file