advanced-sneakers-activejob 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/README.md +0 -3
- data/advanced-sneakers-activejob.gemspec +1 -1
- data/lib/advanced_sneakers_activejob/configuration.rb +5 -2
- data/lib/advanced_sneakers_activejob/delayed_publisher.rb +11 -11
- data/lib/advanced_sneakers_activejob/publisher.rb +2 -2
- data/lib/advanced_sneakers_activejob/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a83b8e71434ad265d08febb7a8c186813c37971b0ce8c83520699a9a0e8bf71d
|
4
|
+
data.tar.gz: 53546ff1d7a72231ac909ad8a3e23c10f5606e0ecc1b6eae431f49de8b3c4af7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af2a68a5be7dedd658e7efc835b2fea1904c1e63ea0dd0b4f083405b62c686d8f160a44eaf3119a90e886a8cab73066a6d839cb1d2152f4b27c759edf382cb94
|
7
|
+
data.tar.gz: 4c6365c18cf1aeeb469b6ea2d6df39866149874400a713d2ab785df7d3c09577b9200dcfe0f8a4de336bebc9809933d9bd9ba2ec6f6fb2693f1e76a2f87539fa
|
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,13 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
6
6
|
|
7
|
-
## [Unreleased](https://github.com/veeqo/advanced-sneakers-activejob/compare/v0.
|
7
|
+
## [Unreleased](https://github.com/veeqo/advanced-sneakers-activejob/compare/v0.5.0...HEAD)
|
8
|
+
|
9
|
+
|
10
|
+
## [0.5.0](https://github.com/veeqo/advanced-sneakers-activejob/compare/v0.4.0...v0.5.0) - 2020-11-30
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
- [#16](https://github.com/veeqo/advanced-sneakers-activejob/pull/16) Switch to bunny-publisher v0.2 (drops republish connection)
|
8
14
|
|
9
15
|
|
10
16
|
## [0.4.0](https://github.com/veeqo/advanced-sneakers-activejob/compare/v0.3.6...v0.4.0) - 2020-11-17
|
data/README.md
CHANGED
@@ -181,9 +181,6 @@ AdvancedSneakersActiveJob.configure do |config|
|
|
181
181
|
|
182
182
|
# Connection for publisher (fallbacks to connection of consumers)
|
183
183
|
config.publish_connection = Bunny.new('CUSTOM_URL', with: { other: 'options' })
|
184
|
-
|
185
|
-
# Unrouted messages republish requires extra connection and will try to "clone" publish_connection unless it is provided
|
186
|
-
config.republish_connection = Bunny.new('CUSTOM_URL', with: { other: 'options' })
|
187
184
|
end
|
188
185
|
```
|
189
186
|
|
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.require_paths = ['lib']
|
28
28
|
|
29
29
|
spec.add_dependency 'activejob', '>= 4.2'
|
30
|
-
spec.add_dependency 'bunny-publisher', '~> 0.
|
30
|
+
spec.add_dependency 'bunny-publisher', '~> 0.2.0'
|
31
31
|
spec.add_dependency 'sneakers', '~> 2.7'
|
32
32
|
|
33
33
|
spec.add_development_dependency 'appraisal', '~> 2.3.0'
|
@@ -18,7 +18,10 @@ module AdvancedSneakersActiveJob
|
|
18
18
|
config_accessor(:retry_delay_proc) { ->(count) { AdvancedSneakersActiveJob::EXPONENTIAL_BACKOFF[count] } } # seconds
|
19
19
|
|
20
20
|
config_accessor(:publish_connection)
|
21
|
-
|
21
|
+
|
22
|
+
def republish_connection=(_)
|
23
|
+
ActiveSupport::Deprecation.warn('Republish connection is not used for bunny-publisher v0.2+')
|
24
|
+
end
|
22
25
|
|
23
26
|
def sneakers
|
24
27
|
custom_config = DEFAULT_SNEAKERS_CONFIG.deep_merge(config.sneakers || {})
|
@@ -35,7 +38,7 @@ module AdvancedSneakersActiveJob
|
|
35
38
|
end
|
36
39
|
|
37
40
|
def publisher_config
|
38
|
-
sneakers.merge(publish_connection: publish_connection
|
41
|
+
sneakers.merge(publish_connection: publish_connection)
|
39
42
|
end
|
40
43
|
end
|
41
44
|
end
|
@@ -17,24 +17,20 @@ module AdvancedSneakersActiveJob
|
|
17
17
|
attr_reader :dlx_exchange_name
|
18
18
|
|
19
19
|
def initialize(exchange:, **options)
|
20
|
-
super(options.merge(exchange: [exchange, 'delayed'].join('-'), exchange_options: { type: 'headers', durable: true }))
|
20
|
+
super(**options.merge(exchange: [exchange, 'delayed'].join('-'), exchange_options: { type: 'headers', durable: true }))
|
21
21
|
|
22
22
|
@dlx_exchange_name = exchange
|
23
23
|
end
|
24
24
|
|
25
25
|
private
|
26
26
|
|
27
|
-
def log_message
|
27
|
+
def log_message
|
28
28
|
logger.debug do
|
29
|
-
|
30
|
-
|
31
|
-
"Publishing <#{message}> to [#{publisher.exchange.name}] with routing_key [#{options[:routing_key]}] and delay [#{delay}]"
|
29
|
+
"Publishing <#{message}> to [#{@exchange_name}] with routing_key [#{message_options[:routing_key]}] and delay [#{delay}]"
|
32
30
|
end
|
33
31
|
end
|
34
32
|
|
35
|
-
def declare_republish_queue
|
36
|
-
delay = properties.headers.fetch('delay')
|
37
|
-
|
33
|
+
def declare_republish_queue
|
38
34
|
queue_name = delayed_queue_name(delay: delay)
|
39
35
|
|
40
36
|
queue_arguments = {
|
@@ -45,11 +41,15 @@ module AdvancedSneakersActiveJob
|
|
45
41
|
|
46
42
|
logger.debug { "Creating delayed queue [#{queue_name}]" }
|
47
43
|
|
48
|
-
|
44
|
+
channel.queue(queue_name, durable: true, arguments: queue_arguments)
|
45
|
+
end
|
46
|
+
|
47
|
+
def delay
|
48
|
+
message_options.dig(:headers, 'delay')
|
49
49
|
end
|
50
50
|
|
51
|
-
def declare_republish_queue_binding(queue
|
52
|
-
queue.bind(
|
51
|
+
def declare_republish_queue_binding(queue)
|
52
|
+
queue.bind(exchange, arguments: { delay: delay })
|
53
53
|
end
|
54
54
|
|
55
55
|
def delayed_queue_name(delay:)
|
@@ -14,9 +14,9 @@ module AdvancedSneakersActiveJob
|
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
|
-
def log_message
|
17
|
+
def log_message
|
18
18
|
logger.debug do
|
19
|
-
"Publishing <#{message}> to [#{
|
19
|
+
"Publishing <#{message}> to [#{@exchange_name}] with routing_key [#{message_options[:routing_key]}]"
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: advanced-sneakers-activejob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rustam Sharshenov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-11-
|
12
|
+
date: 2020-11-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activejob
|
@@ -31,14 +31,14 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: 0.2.0
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
41
|
+
version: 0.2.0
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: sneakers
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
184
|
- !ruby/object:Gem::Version
|
185
185
|
version: '0'
|
186
186
|
requirements: []
|
187
|
-
rubygems_version: 3.1.
|
187
|
+
rubygems_version: 3.1.4
|
188
188
|
signing_key:
|
189
189
|
specification_version: 4
|
190
190
|
summary: Advanced Sneakers adapter for ActiveJob
|