eventq_rabbitmq 1.10.3 → 1.10.4

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: fc4a1cad923c9ffc801fcd8cb34d7e9a72e09f0d
4
- data.tar.gz: e7db3536d2d51945b4f5471a055e73488799f157
3
+ metadata.gz: 1e56bd84cbee6f49b6dead60a68cb600092fa0e5
4
+ data.tar.gz: 7a08b8efdd47ead507c90649449a6599d095d224
5
5
  SHA512:
6
- metadata.gz: 07f7b08a417978012a62b9ce6a63d86bd086d267fa398d2e12c07c3eef9c079e9afb6783509894ac0d8c74122d520a24d8f7aaadd29782e2ee526e9a7d27492f
7
- data.tar.gz: bd154bd83cc3cd648b43ba447a4ad909c563bc041bab53df9226c63474fd667caecd2d984ef2eaeb2b9eddb64d292e88cb090000ebfff45fcd76143b25e32618
6
+ metadata.gz: 20709f9bd6255ecb6c50cc74e71bef1bffdb4ce00ffc23655abf4d537aaa2827dc8413a226fd78bff6ed2f5d817cb208c806d5a06acd958dde21b1624fd79338
7
+ data.tar.gz: 86049fb088de5e4103aa8a80d5b5838f281305217e8497170d0d9204cd67d638a043bd6ad38b3ac99dc676a1830e549a7f22e282b46fb3bb9b3761c6e932d880
@@ -105,8 +105,10 @@ module EventQ
105
105
 
106
106
  if !has_received_message
107
107
  EventQ.log(:debug, "[#{self.class}] - No message received.")
108
- EventQ.log(:debug, "[#{self.class}] - Sleeping for #{@sleep} seconds")
109
- sleep(@sleep)
108
+ if @sleep > 0
109
+ EventQ.log(:debug, "[#{self.class}] - Sleeping for #{@sleep} seconds")
110
+ sleep(@sleep)
111
+ end
110
112
  end
111
113
 
112
114
  end
@@ -196,49 +198,45 @@ module EventQ
196
198
  end
197
199
 
198
200
  def reject_message(channel, message, delivery_info, retry_exchange, queue)
201
+
202
+ EventQ.log(:info, "[#{self.class}] - Message rejected removing from queue.")
199
203
  #reject the message to remove from queue
200
204
  channel.reject(delivery_info.delivery_tag, false)
201
205
 
202
- EventQ.log(:info, "[#{self.class}] - Message rejected.")
203
-
204
- #check if the message is allowed to be retried
205
- if queue.allow_retry
206
-
207
- EventQ.log(:debug, "[#{self.class}] - Checking retry attempts...")
208
-
209
- if message.retry_attempts < queue.max_retry_attempts
210
- EventQ.log(:debug, "[#{self.class}] - Incrementing retry attempts count.")
211
- message.retry_attempts += 1
212
-
213
- if queue.allow_retry_back_off == true
214
- EventQ.log(:debug, "[#{self.class}] - Calculating message back off retry delay. Attempts: #{message.retry_attempts} * Retry Delay: #{queue.retry_delay}")
215
- message_ttl = message.retry_attempts * queue.retry_delay
216
- if (message.retry_attempts * queue.retry_delay) > queue.max_retry_delay
217
- EventQ.log(:debug, "[#{self.class}] - Max message back off retry delay reached.")
218
- message_ttl = queue.max_retry_delay
219
- end
220
- else
221
- EventQ.log(:debug, "[#{self.class}] - Setting fixed retry delay for message.")
222
- message_ttl = queue.retry_delay
223
- end
206
+ #check if the message retry limit has been exceeded
207
+ if message.retry_attempts >= queue.max_retry_attempts
224
208
 
225
- EventQ.log(:debug, "[#{self.class}] - Sending message for retry. Message TTL: #{message_ttl}")
226
- retry_exchange.publish(serialize_message(message), :expiration => message_ttl)
227
- EventQ.log(:debug, "[#{self.class}] - Published message to retry exchange.")
209
+ EventQ.log(:info, "[#{self.class}] - Message retry attempt limit exceeded. Msg: #{serialize_message(message)}")
228
210
 
211
+ if @retry_exceeded_block != nil
212
+ EventQ.log(:debug, "[#{self.class}] - Executing retry exceeded block.")
213
+ @retry_exceeded_block.call(message)
229
214
  else
215
+ EventQ.log(:debug, "[#{self.class}] - No retry exceeded block specified.")
216
+ end
230
217
 
231
- EventQ.log(:info, "[#{self.class}] - Message retry attempts exceeded. Message: #{serialize_message(message)}")
218
+ #check if the message is allowed to be retried
219
+ elsif queue.allow_retry
232
220
 
233
- if @retry_exceeded_block != nil
234
- EventQ.log(:debug, "[#{self.class}] - Executing retry exceeded block.")
235
- @retry_exceeded_block.call(message)
236
- else
237
- EventQ.log(:debug, "[#{self.class}] - No retry exceeded block specified.")
238
- end
221
+ EventQ.log(:debug, "[#{self.class}] - Incrementing retry attempts count.")
222
+ message.retry_attempts += 1
239
223
 
224
+ if queue.allow_retry_back_off == true
225
+ EventQ.log(:debug, "[#{self.class}] - Calculating message back off retry delay. Attempts: #{message.retry_attempts} * Retry Delay: #{queue.retry_delay}")
226
+ message_ttl = message.retry_attempts * queue.retry_delay
227
+ if (message.retry_attempts * queue.retry_delay) > queue.max_retry_delay
228
+ EventQ.log(:debug, "[#{self.class}] - Max message back off retry delay reached.")
229
+ message_ttl = queue.max_retry_delay
230
+ end
231
+ else
232
+ EventQ.log(:debug, "[#{self.class}] - Setting fixed retry delay for message.")
233
+ message_ttl = queue.retry_delay
240
234
  end
241
235
 
236
+ EventQ.log(:debug, "[#{self.class}] - Sending message for retry. Message TTL: #{message_ttl}")
237
+ retry_exchange.publish(serialize_message(message), :expiration => message_ttl)
238
+ EventQ.log(:debug, "[#{self.class}] - Published message to retry exchange.")
239
+
242
240
  end
243
241
 
244
242
  return true
@@ -284,11 +282,12 @@ module EventQ
284
282
  error = false
285
283
  message = deserialize_message(payload)
286
284
 
287
- EventQ.log(:debug, "[#{self.class}] - Message received. Retry Attempts: #{message.retry_attempts}")
285
+ EventQ.log(:info, "[#{self.class}] - Message received. Retry Attempts: #{message.retry_attempts}")
288
286
 
289
287
  message_args = EventQ::MessageArgs.new(message.type, message.retry_attempts)
290
288
 
291
289
  if(!EventQ::NonceManager.is_allowed?(message.id))
290
+ EventQ.log(:info, "[#{self.class}] - Duplicate Message received. Dropping message.")
292
291
  channel.acknowledge(delivery_info.delivery_tag, false)
293
292
  return false
294
293
  end
@@ -1,3 +1,3 @@
1
1
  module EventqRabbitmq
2
- VERSION = "1.10.3"
2
+ VERSION = "1.10.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventq_rabbitmq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.3
4
+ version: 1.10.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - vaughanbrittonsage
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-24 00:00:00.000000000 Z
11
+ date: 2016-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler