sneakers-laces 0.1.3 → 0.1.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
  SHA256:
3
- metadata.gz: a1206cca953a14cfff60f156b932c1199052383359cb87b1e84057c20f48eaec
4
- data.tar.gz: 61d8857d8c0a1fafcedbbaaa10fa006f1f94b00123dce4791a8d32e3b37e6388
3
+ metadata.gz: c1baa8d6fe1ebbe25b55a7f1136054fb2468b55b78d0b7543330fde137a12d2d
4
+ data.tar.gz: 1e013256481dcf1c835457bd75a689e163dd7a809f46c7885824b0cd47a3cf94
5
5
  SHA512:
6
- metadata.gz: 7236d4a4dcf42df846170ef29d3a952dc3c78d8b5e358f4da00d3c86165799c83dd8f7e3c2942fc61c085d34f2c69f6c6aa26f2f0273ec03bff93062d8a25b3f
7
- data.tar.gz: 73112e71b09aa755be29523ffb06f13fda9f53f17dc58935a815ab8076beadbf834988160c14855b5c746fb59b8229fd6db2519be555d1bdbdc180256d8cea49
6
+ metadata.gz: 9d5365623de783f812b17878c7768b49f092faeca73bfadd08b22c96d7bdc8fa8024cfc8800b46a44d6ffb8eeebfb4c5d29229389777c8c993e0450988ccb1d6
7
+ data.tar.gz: fae5638072c5b67608c9dd099ae87b5e2c1675eadcaa01435eca865354139273649455bd9049f463699d83b20b79b825c2ed7239bd2d9ed28e71174c7b9b5d26
@@ -10,7 +10,7 @@ module Sneakers
10
10
  def declare_queue(name:, worker_tag:, routing_key: nil, binding_arguments: [], params: {}, reload: true)
11
11
  api_client.declare_queue vhost,
12
12
  name,
13
- params_with_worker_tag(worker_tag, params)
13
+ params_for_queue(name, worker_tag, params)
14
14
 
15
15
  api_client.bind_queue(vhost, name, exchange, (routing_key || name), binding_arguments)
16
16
 
@@ -78,9 +78,10 @@ module Sneakers
78
78
  end
79
79
  end
80
80
 
81
- def params_with_worker_tag(worker_tag, params = {})
81
+ def params_for_queue(name, worker_tag, params = {})
82
82
  Sneakers::CONFIG.fetch(:queue_options).merge(params.deep_symbolize_keys).tap do |p|
83
- p[:arguments][WORKER_TAG_ARGUMENT] = worker_tag
83
+ p[:arguments][WORKER_TAG_ARGUMENT] = worker_tag
84
+ p[:arguments]['x-dead-letter-exchange'] = retry_exchange_name(name) if maxretry_handler_enabled?
84
85
  end
85
86
  end
86
87
 
@@ -95,6 +96,14 @@ module Sneakers
95
96
  def exchange
96
97
  Sneakers::CONFIG.fetch(:exchange)
97
98
  end
99
+
100
+ def retry_exchange_name(name)
101
+ [name, 'retry'].join('-')
102
+ end
103
+
104
+ def maxretry_handler_enabled?
105
+ Sneakers::CONFIG[:handler] && Sneakers::CONFIG[:handler].name == 'Sneakers::Handlers::Maxretry'
106
+ end
98
107
  end
99
108
  end
100
109
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sneakers
4
4
  module Laces
5
- VERSION = '0.1.3'
5
+ VERSION = '0.1.4'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sneakers-laces
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rustam Sharshenov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-17 00:00:00.000000000 Z
11
+ date: 2018-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport