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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7828be1674a92df4c43f0e86df282461e158438252ea16439d26f3ffc3bf1a22
4
- data.tar.gz: 1e0248e9dd8b8af0b3c5b5da1294bc970f93f501bfb8185c19c1da486d78514f
3
+ metadata.gz: a83b8e71434ad265d08febb7a8c186813c37971b0ce8c83520699a9a0e8bf71d
4
+ data.tar.gz: 53546ff1d7a72231ac909ad8a3e23c10f5606e0ecc1b6eae431f49de8b3c4af7
5
5
  SHA512:
6
- metadata.gz: bd60af5cc86febf88ec62c11dbe5b90b5528f96d1b7b4a357cec61e01260e3b587a4e3e69b171508866685827468c1084a294baa3e5a2ba8c7cbf35a8cae20f0
7
- data.tar.gz: 546258b0a88d0a105ac120dcb90c68c3608f8a4123e5ad556881f5fed331bb18a68ea074801f286d5c3d64ecc2814a75fd1fc0ad5866708908a230cf09e3e5b6
6
+ metadata.gz: af2a68a5be7dedd658e7efc835b2fea1904c1e63ea0dd0b4f083405b62c686d8f160a44eaf3119a90e886a8cab73066a6d839cb1d2152f4b27c759edf382cb94
7
+ data.tar.gz: 4c6365c18cf1aeeb469b6ea2d6df39866149874400a713d2ab785df7d3c09577b9200dcfe0f8a4de336bebc9809933d9bd9ba2ec6f6fb2693f1e76a2f87539fa
@@ -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.4.0...HEAD)
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.1'
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
- config_accessor(:republish_connection)
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, republish_connection: republish_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(publisher, message, options = {})
27
+ def log_message
28
28
  logger.debug do
29
- delay = options.dig(:headers, 'delay')
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(_return_info, properties, _message)
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
- republish_channel.queue(queue_name, durable: true, arguments: queue_arguments)
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, _return_info, properties, _message)
52
- queue.bind(republish_exchange, arguments: { delay: properties.headers.fetch('delay') })
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(publisher, message, options = {})
17
+ def log_message
18
18
  logger.debug do
19
- "Publishing <#{message}> to [#{publisher.exchange.name}] with routing_key [#{options[:routing_key]}]"
19
+ "Publishing <#{message}> to [#{@exchange_name}] with routing_key [#{message_options[:routing_key]}]"
20
20
  end
21
21
  end
22
22
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AdvancedSneakersActiveJob
4
- VERSION = '0.4.0'
4
+ VERSION = '0.5.0'
5
5
  end
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.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-17 00:00:00.000000000 Z
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: '0.1'
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: '0.1'
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.2
187
+ rubygems_version: 3.1.4
188
188
  signing_key:
189
189
  specification_version: 4
190
190
  summary: Advanced Sneakers adapter for ActiveJob