eventq_rabbitmq 1.8.0 → 1.8.1

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: 61ce485e370a78cd9d450104b7083fcdbf6bf770
4
- data.tar.gz: 2b3a282086892b4c512f0038e8c2ea9a1a2826e3
3
+ metadata.gz: 96c30cb1ae498d1150a5117aa1e64c05dd5570ad
4
+ data.tar.gz: 26ce2d3f2bac930f75222036615dd0fecf2ed6bc
5
5
  SHA512:
6
- metadata.gz: e6c8908c68e95970ea62da7b63ddb6542fce81f526e002a73cdfc5d36703ee5e58c0d05bcff0734fa5f981679f3f3c667ce3734e27e2a27ef323a14e298bc03e
7
- data.tar.gz: c7c592a4af075ebb275ca21210b6901f81c71bb4d7f5dcd0395620f91a30f9e8bd8b7785341908b32ec6b3413ec9e0506c4352c42af491865eb67aa1dfbcf5b9
6
+ metadata.gz: 86c1d737de716bb6a2ab5bd2fd97d098c97df2fa17f8c5c137248d21efd33173055bbdc36b0c1cf798e16186b3a677e5e33922757efbb9aab5c69de124ca64c1
7
+ data.tar.gz: 145c03a98b3cbac3804c3102002c0248ccc5bc2a6b9940af71bc760b41327627b4ff41672d6c55bec7e4b7aa4cb3593fa6ee8ccaf92fdbafd38ec12be2fe1f4a
@@ -128,42 +128,20 @@ module EventQ
128
128
 
129
129
  received = false
130
130
  error = false
131
- abort = false
132
131
 
133
132
  begin
134
133
  delivery_info, properties, payload = q.pop(:manual_ack => true, :block => true)
135
134
 
136
135
  #check that message was received
137
136
  if payload != nil
138
- tag_processing_thread
139
-
140
- message = deserialize_message(payload)
141
-
142
- EventQ.log(:debug, "[#{self.class}] - Message received. Retry Attempts: #{message.retry_attempts}")
143
-
144
- message_args = EventQ::MessageArgs.new(message.type, message.retry_attempts)
145
-
146
- #begin worker block for queue message
147
137
  begin
148
- block.call(message.content, message_args)
149
-
150
- if message_args.abort == true
151
- abort = true
152
- EventQ.log(:info, "[#{self.class}] - Message aborted.")
153
- else
154
- #accept the message as processed
155
- channel.acknowledge(delivery_info.delivery_tag, false)
156
- EventQ.log(:info, "[#{self.class}] - Message acknowledged.")
157
- received = true
138
+ tag_processing_thread
139
+ process_message(payload, queue, channel, retry_exchange, delivery_info, block) do |received, error|
140
+ received = received
141
+ error = error
158
142
  end
159
-
160
- rescue => e
161
- EventQ.log(:error, "[#{self.class}] - An unhandled error happened attempting to process a queue message. Error: #{e} | Backtrace: #{e.backtrace}")
162
- error = true
163
- end
164
-
165
- if error || abort
166
- reject_message(channel, message, delivery_info, retry_exchange, queue)
143
+ ensure
144
+ untag_processing_thread
167
145
  end
168
146
 
169
147
  end
@@ -284,6 +262,41 @@ module EventQ
284
262
 
285
263
  end
286
264
 
265
+ private
266
+
267
+ def process_message(payload, queue, channel, retry_exchange, delivery_info, block)
268
+ abort = false
269
+ message = deserialize_message(payload)
270
+
271
+ EventQ.log(:debug, "[#{self.class}] - Message received. Retry Attempts: #{message.retry_attempts}")
272
+
273
+ message_args = EventQ::MessageArgs.new(message.type, message.retry_attempts)
274
+
275
+ #begin worker block for queue message
276
+ begin
277
+ block.call(message.content, message_args)
278
+
279
+ if message_args.abort == true
280
+ abort = true
281
+ EventQ.log(:info, "[#{self.class}] - Message aborted.")
282
+ else
283
+ #accept the message as processed
284
+ channel.acknowledge(delivery_info.delivery_tag, false)
285
+ EventQ.log(:info, "[#{self.class}] - Message acknowledged.")
286
+ received = true
287
+ end
288
+
289
+ rescue => e
290
+ EventQ.log(:error, "[#{self.class}] - An unhandled error happened attempting to process a queue message. Error: #{e} | Backtrace: #{e.backtrace}")
291
+ error = true
292
+ end
293
+
294
+ if error || abort
295
+ reject_message(channel, message, delivery_info, retry_exchange, queue)
296
+ end
297
+
298
+ yield [received, error]
299
+ end
287
300
  end
288
301
  end
289
302
  end
@@ -1,3 +1,3 @@
1
1
  module EventqRabbitmq
2
- VERSION = "1.8.0"
2
+ VERSION = "1.8.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventq_rabbitmq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - vaughanbrittonsage