message_bus_client_worker 1.2.2 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f7e3c9b947b2fa159ea74d50f018784ac5fcd25bdf021ef845c505b28c90ff6
4
- data.tar.gz: 264bb1f14cabfda8a51c058907879d205497fe05226c4c9e8d3ab8a85e11cafc
3
+ metadata.gz: d7fea76cd116cee19a6770027158c1ede8fa993ebe8ab6941fbfe79478d8a059
4
+ data.tar.gz: e37e7016be468245237e8d0a2b17ea0f9944073833a623e6b571b16a17353f99
5
5
  SHA512:
6
- metadata.gz: d708bfd122db410bf056edf86213fef2bc6fbf12560d78cc6eb6575db42ad9cf9b76418cdc02896d4e12785fd8f73b0ec0e0f1190dd7f17a29cfa44509b480dd
7
- data.tar.gz: 550a4e018642df9e5569a31fcf0f5783ff57022c361a9d84e20f69884ce3535cd991042417d62d3e97f59e759f0d970dfe2c0818623114d0b1d56da4a74d3222
6
+ metadata.gz: 3fc0a430aefb533a04b359ee36e05b649ba8133c0ac37d126bfd5562dcfc3b4025e77a4fdd16416ddf041688c5e18787a165e38df7a612b74d75eae97582f0a0
7
+ data.tar.gz: 9e438dd0f45009973dc990cdedb4960755c3b222dcb827f727fa91b7fb29ecc584fdd3364945ef8827a02aee6bb706213804df608bbc28d056250cb503afaf92
@@ -0,0 +1,32 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+
21
+ steps:
22
+ - uses: actions/checkout@v2
23
+ - name: Set up Ruby
24
+ uses: ruby/setup-ruby@v1
25
+ with:
26
+ ruby-version: 2.7.0
27
+ - name: Start dbs
28
+ run: docker-compose up --detach sidekiq chat
29
+ - name: Copy config
30
+ run: cp spec/config.yml{.sample,}
31
+ - name: Run tests
32
+ run: docker-compose run gem bundle exec rspec spec
data/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [2.1.1] - 2022-05-26
8
+ ### Fixed
9
+ - Support for Sidekiq 7 or when `Sidekiq.strict_args!` is called
10
+
11
+ ## [2.1.0] - 2021-10-01
12
+ ### Added
13
+ - `MessageBusClientWorker.subscribe(host, config)` which recommended over setting subscriptions via `configure`
14
+
15
+ ## [2.0.0] - 2020-03-12
16
+ ### Changed
17
+ - Update logging in Sidekiq; requires Sidekiq 6
18
+
7
19
  ## [1.2.2] - 2020-03-12
8
20
  ### Fixed
9
21
  - ensure sidekiq `< 6` is installed, since `Sidekiq::Logging` is not available
data/Gemfile.lock CHANGED
@@ -1,49 +1,50 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- message_bus_client_worker (1.2.2)
4
+ message_bus_client_worker (2.1.1)
5
5
  activesupport
6
6
  addressable
7
7
  excon
8
8
  gem_config
9
9
  light-service
10
- sidekiq (>= 5.1, < 6)
10
+ sidekiq (~> 6.0)
11
11
 
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- activesupport (6.0.2.1)
15
+ activesupport (6.1.6)
16
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
- i18n (>= 0.7, < 2)
18
- minitest (~> 5.1)
19
- tzinfo (~> 1.1)
20
- zeitwerk (~> 2.2)
21
- addressable (2.7.0)
17
+ i18n (>= 1.6, < 2)
18
+ minitest (>= 5.1)
19
+ tzinfo (~> 2.0)
20
+ zeitwerk (~> 2.3)
21
+ addressable (2.8.0)
22
22
  public_suffix (>= 2.0.2, < 5.0)
23
23
  byebug (10.0.2)
24
24
  coderay (1.1.2)
25
- concurrent-ruby (1.0.5)
25
+ concurrent-ruby (1.1.10)
26
26
  connection_pool (2.2.2)
27
27
  diff-lcs (1.3)
28
- excon (0.72.0)
28
+ excon (0.92.3)
29
29
  gem_config (0.3.2)
30
- i18n (1.8.2)
30
+ i18n (1.10.0)
31
31
  concurrent-ruby (~> 1.0)
32
- light-service (0.12.0)
32
+ light-service (0.18.0)
33
+ activesupport (>= 4.0.0)
33
34
  method_source (0.9.0)
34
- minitest (5.14.0)
35
+ minitest (5.15.0)
35
36
  pry (0.11.3)
36
37
  coderay (~> 1.1.0)
37
38
  method_source (~> 0.9.0)
38
39
  pry-byebug (3.6.0)
39
40
  byebug (~> 10.0)
40
41
  pry (~> 0.10)
41
- public_suffix (4.0.3)
42
- rack (2.0.6)
43
- rack-protection (2.0.3)
42
+ public_suffix (4.0.7)
43
+ rack (2.2.2)
44
+ rack-protection (2.0.8.1)
44
45
  rack
45
46
  rake (10.5.0)
46
- redis (4.0.1)
47
+ redis (4.1.3)
47
48
  rspec (3.7.0)
48
49
  rspec-core (~> 3.7.0)
49
50
  rspec-expectations (~> 3.7.0)
@@ -60,22 +61,20 @@ GEM
60
61
  rspec-core (~> 3.0, >= 3.0.0)
61
62
  sidekiq (>= 2.4.0)
62
63
  rspec-support (3.7.1)
63
- sidekiq (5.1.3)
64
+ sidekiq (6.0.5)
65
+ connection_pool (>= 2.2.2)
66
+ rack (~> 2.0)
67
+ rack-protection (>= 2.0.0)
68
+ redis (>= 4.1.0)
69
+ tzinfo (2.0.4)
64
70
  concurrent-ruby (~> 1.0)
65
- connection_pool (~> 2.2, >= 2.2.0)
66
- rack-protection (>= 1.5.0)
67
- redis (>= 3.3.5, < 5)
68
- thread_safe (0.3.6)
69
- tzinfo (1.2.6)
70
- thread_safe (~> 0.1)
71
71
  wait (0.5.3)
72
- zeitwerk (2.3.0)
72
+ zeitwerk (2.5.4)
73
73
 
74
74
  PLATFORMS
75
75
  ruby
76
76
 
77
77
  DEPENDENCIES
78
- bundler (~> 1.16)
79
78
  message_bus_client_worker!
80
79
  pry-byebug
81
80
  rake (~> 10.0)
@@ -84,4 +83,4 @@ DEPENDENCIES
84
83
  wait
85
84
 
86
85
  BUNDLED WITH
87
- 1.17.3
86
+ 2.2.28
data/docker-compose.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  version: "3.2"
2
2
  services:
3
3
  redis:
4
- image: redis:4.0.10
4
+ image: redis:5.0.7
5
5
  ports:
6
6
  - "6379:6379"
7
7
  gem:
@@ -1,3 +1,3 @@
1
1
  module MessageBusClientWorker
2
- VERSION = "1.2.2"
2
+ VERSION = "2.1.1"
3
3
  end
@@ -6,7 +6,7 @@ module MessageBusClientWorker
6
6
 
7
7
  def perform
8
8
  MessageBusClientWorker.configuration.subscriptions.each do |host, subs|
9
- SubscriptionWorker.perform_async(host, subs)
9
+ SubscriptionWorker.perform_async(host, subs.to_json)
10
10
  end
11
11
  end
12
12
 
@@ -4,16 +4,18 @@ module MessageBusClientWorker
4
4
  include Sidekiq::Worker
5
5
  sidekiq_options retry: 0
6
6
 
7
- def perform(host, subscriptions, long = false)
8
- log(host, subscriptions.with_indifferent_access)
9
- Poll.call(host, subscriptions.with_indifferent_access, long)
7
+ def perform(host, subscriptions_json, long = false)
8
+ subscriptions = JSON.parse(subscriptions_json).with_indifferent_access
9
+
10
+ log(host, subscriptions)
11
+ Poll.call(host, subscriptions, long)
10
12
  end
11
13
 
12
14
  private
13
15
 
14
16
  def log(host, subscriptions)
15
17
  subscriptions[:channels].each do |channel, _|
16
- Sidekiq::Logging.logger.info "Enqueued #{host} for #{channel}"
18
+ logger.info "Enqueued #{host} for #{channel}"
17
19
  end
18
20
  end
19
21
 
@@ -26,8 +26,18 @@ module MessageBusClientWorker
26
26
  include GemConfig::Base
27
27
 
28
28
  with_configuration do
29
- has :subscriptions, classes: Hash
29
+ has :subscriptions, classes: [Hash, NilClass]
30
30
  has :client_id, classes: [Proc, String], default: -> {SecureRandom.uuid}
31
31
  end
32
32
 
33
+ def self.subscribe(host, options)
34
+ self.configuration.subscriptions ||= {}
35
+
36
+ if self.configuration.subscriptions.keys.include?(host)
37
+ warn "[#{self.name}] #{host} already configured, overwriting (called from #{caller.first})"
38
+ end
39
+
40
+ self.configuration.subscriptions[host] = options
41
+ end
42
+
33
43
  end
@@ -31,13 +31,12 @@ Gem::Specification.new do |spec|
31
31
  spec.require_paths = ["lib"]
32
32
 
33
33
  spec.add_dependency "gem_config"
34
- spec.add_dependency "sidekiq", ">= 5.1", "< 6"
34
+ spec.add_dependency "sidekiq", "~> 6.0"
35
35
  spec.add_dependency "excon"
36
36
  spec.add_dependency "addressable"
37
37
  spec.add_dependency "light-service"
38
38
  spec.add_dependency "activesupport"
39
39
 
40
- spec.add_development_dependency "bundler", "~> 1.16"
41
40
  spec.add_development_dependency "rake", "~> 10.0"
42
41
  spec.add_development_dependency "rspec", "~> 3.0"
43
42
  spec.add_development_dependency "rspec-sidekiq"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: message_bus_client_worker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ramon Tayag
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-12 00:00:00.000000000 Z
11
+ date: 2022-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_config
@@ -28,22 +28,16 @@ dependencies:
28
28
  name: sidekiq
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '5.1'
34
- - - "<"
31
+ - - "~>"
35
32
  - !ruby/object:Gem::Version
36
- version: '6'
33
+ version: '6.0'
37
34
  type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: '5.1'
44
- - - "<"
38
+ - - "~>"
45
39
  - !ruby/object:Gem::Version
46
- version: '6'
40
+ version: '6.0'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: excon
49
43
  requirement: !ruby/object:Gem::Requirement
@@ -100,20 +94,6 @@ dependencies:
100
94
  - - ">="
101
95
  - !ruby/object:Gem::Version
102
96
  version: '0'
103
- - !ruby/object:Gem::Dependency
104
- name: bundler
105
- requirement: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - "~>"
108
- - !ruby/object:Gem::Version
109
- version: '1.16'
110
- type: :development
111
- prerelease: false
112
- version_requirements: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - "~>"
115
- - !ruby/object:Gem::Version
116
- version: '1.16'
117
97
  - !ruby/object:Gem::Dependency
118
98
  name: rake
119
99
  requirement: !ruby/object:Gem::Requirement
@@ -170,17 +150,17 @@ dependencies:
170
150
  - - ">="
171
151
  - !ruby/object:Gem::Version
172
152
  version: '0'
173
- description:
153
+ description:
174
154
  email:
175
155
  - ramon.tayag@gmail.com
176
156
  executables: []
177
157
  extensions: []
178
158
  extra_rdoc_files: []
179
159
  files:
160
+ - ".github/workflows/ruby.yml"
180
161
  - ".gitignore"
181
162
  - ".rspec"
182
163
  - ".ruby-version"
183
- - ".travis.yml"
184
164
  - CHANGELOG.md
185
165
  - CODE_OF_CONDUCT.md
186
166
  - Dockerfile
@@ -211,7 +191,7 @@ licenses:
211
191
  - MIT
212
192
  metadata:
213
193
  allowed_push_host: https://rubygems.org
214
- post_install_message:
194
+ post_install_message:
215
195
  rdoc_options: []
216
196
  require_paths:
217
197
  - lib
@@ -226,8 +206,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
206
  - !ruby/object:Gem::Version
227
207
  version: '0'
228
208
  requirements: []
229
- rubygems_version: 3.0.8
230
- signing_key:
209
+ rubygems_version: 3.1.6
210
+ signing_key:
231
211
  specification_version: 4
232
212
  summary: Subscribe to MessageBus using Sidekiq workers
233
213
  test_files: []
data/.travis.yml DELETED
@@ -1,8 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.5.1
5
- before_script:
6
- - cp spec/config.yml{.sample,}
7
- - docker-compose up -d sidekiq chat
8
- script: docker-compose run gem bundle exec rspec spec