istox 0.1.134 → 0.1.135

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
  SHA256:
3
- metadata.gz: 2a20392d2531872f0931ae534352ee8e42b30dc1ee72def8e7fea39879148915
4
- data.tar.gz: 57625d60cec35ba285ab6b892aa7265ab96158a2f885cbf3a70127c7fdb6d6cc
3
+ metadata.gz: ea4ecfc5feab0cbc06336dadb22e0b4070951a0fe4f56293ffa0d1c2ddfe2e41
4
+ data.tar.gz: 40d4295b9dd6e08e094518681f568c893149031e6632357b9dda239975fdcf56
5
5
  SHA512:
6
- metadata.gz: ef4df22baed5bd4c590bfded9318ecbc3f3bc7c72a2aa451ce3a64b50c3b94461ae6c6f51ed5a4d293d5410324b44336c6e5035844ef127c500f2db85a0ee6ac
7
- data.tar.gz: d72f536ce57c150ae7f33cddceacae709c504384acbc21ccd03d0cc89696007eebe0635b59775f51834d5642a9dde1c4e1d2d85ff85f67a220d7164d9500eb18
6
+ metadata.gz: ee86396ae458514e4b432e10b60cce8a2a5d800de2f685e7588338b7d0e63d2add4735566cf2276c147d69f7a0f79f443528e03461d30d3f73128aca255a4d88
7
+ data.tar.gz: e2f8ca172f526606ce70243a3b93eda0ce33f6a2e3746acd92f7e5300dc4529e9bb6da4dcf46a8661b89c014e1a748438ec579393d341136e1119c18de4f4eec
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- istox (0.1.133)
4
+ istox (0.1.134)
5
5
  awesome_print
6
6
  binding_of_caller
7
7
  bunny (>= 2.12.0)
@@ -139,17 +139,25 @@ module Istox
139
139
  # If retry limit is -1, no retry limit
140
140
  # TODO: No matter the amount of retry limit, send cloudwatch critical alarm if fails after 3 times of retry
141
141
  retry_limit = ::Istox::BunnyBoot.queue_retry_limit consumer_key
142
- unless metadata[:priority] && retry_limit != -1 && metadata[:priority] >= retry_limit
143
- processing_paylod = JSON.parse(payload)
144
- processing_paylod = ::Istox::CommonHelper.to_open_struct(processing_paylod) if ::Istox::BunnyBoot.queue_worker_param_format(consumer_key) == 'open_struct'
145
- log.info "Processing in consumer: #{klass}, paylod: #{processing_paylod.to_h.inspect}"
142
+ process = true
143
+ store = true
144
+ process = false if metadata[:priority] && retry_limit != -1 && metadata[:priority] >= retry_limit
145
+ if delivery_info[:routing_key] != queue_name
146
+ log.debug "Get retry message from other queue #{delivery_info[:routing_key]}, just ignore!!"
147
+ process = false
148
+ store = false
149
+ end
150
+ if process
151
+ processing_payload = JSON.parse(payload)
152
+ processing_payload = ::Istox::CommonHelper.to_open_struct(processing_payload) if ::Istox::BunnyBoot.queue_worker_param_format(consumer_key) == 'open_struct'
153
+ log.info "Processing in consumer: #{klass}, payload: #{processing_payload.to_h.inspect}"
146
154
  if @workers[ruby_class].nil?
147
- result = block.call(processing_paylod, metadata, delivery_info) unless block.nil?
155
+ result = block.call(processing_payload, metadata, delivery_info) unless block.nil?
148
156
  else
149
- result = @workers[ruby_class].process(processing_paylod, metadata, delivery_info)
157
+ result = @workers[ruby_class].process(processing_payload, metadata, delivery_info)
150
158
  end
151
159
  else
152
- ::Istox::BunnyBoot.cacheMsg(Time.now.to_s, {queue: queue.name, payload: payload})
160
+ ::Istox::BunnyBoot.cacheMsg(Time.now.to_s, {queue: queue.name, payload: payload}) if store
153
161
  end
154
162
  # active_channel.ack(delivery_info.delivery_tag) if manual_ack
155
163
  rescue StandardError => e
@@ -163,9 +171,9 @@ module Istox
163
171
  log.debug "Consumer Retry count: #{retry_count}"
164
172
  # @option opts [Integer] :priority Message priority, 0 to 9. Not used by RabbitMQ, only applications
165
173
  # here we adopt the unused priority as remaining retry_count
166
- processing_paylod = JSON.parse(payload)
167
- processing_paylod = ::Istox::CommonHelper.to_open_struct(processing_paylod) if ::Istox::BunnyBoot.queue_worker_param_format(consumer_key) == 'open_struct'
168
- ::Istox::BunnyBoot.publish(exchange_retry, processing_paylod, routing_key: "#{queue_name}.retry", priority: retry_count, type: 'dlx')
174
+ processing_payload = JSON.parse(payload)
175
+ processing_payload = ::Istox::CommonHelper.to_open_struct(processing_payload) if ::Istox::BunnyBoot.queue_worker_param_format(consumer_key) == 'open_struct'
176
+ ::Istox::BunnyBoot.publish(exchange_retry, processing_payload, routing_key: "#{queue_name}.retry", priority: retry_count, type: 'dlx')
169
177
  end
170
178
  =begin
171
179
  # For redelivered message, call 'reject' not 'nack' in order to reschedule message to tail not head of queue
@@ -1,3 +1,3 @@
1
1
  module Istox
2
- VERSION = '0.1.134'.freeze
2
+ VERSION = '0.1.135'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: istox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.134
4
+ version: 0.1.135
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siong Leng
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-31 00:00:00.000000000 Z
11
+ date: 2020-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print