msgr 1.4.0 → 1.5.0
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 +4 -4
- data/.github/workflows/test.yml +12 -8
- data/.gitignore +17 -17
- data/.markdownlint.yml +22 -0
- data/.rubocop.yml +2 -2
- data/.vscode/ltex.dictionary.en-US.txt +1 -0
- data/Appraisals +6 -6
- data/CHANGELOG.md +23 -8
- data/Gemfile +1 -1
- data/README.md +11 -5
- data/gemfiles/rails_5.2.gemfile +1 -1
- data/gemfiles/rails_6.0.gemfile +1 -1
- data/gemfiles/rails_6.1.gemfile +1 -1
- data/gemfiles/rails_7.0.gemfile +1 -1
- data/gemfiles/rails_head.gemfile +1 -1
- data/lib/msgr/cli.rb +2 -2
- data/lib/msgr/connection.rb +2 -2
- data/lib/msgr/test_pool.rb +3 -3
- data/lib/msgr/version.rb +2 -2
- data/msgr.gemspec +1 -4
- data/spec/integration/dummy/app/consumers/test_consumer.rb +6 -1
- data/spec/integration/dummy/config/rabbitmq.yml +2 -0
- data/spec/integration/msgr/dispatcher_spec.rb +5 -6
- data/spec/integration/spec_helper.rb +7 -1
- data/spec/integration/test_controller_spec.rb +10 -2
- data/spec/unit/msgr/client_spec.rb +2 -2
- data/spec/unit/msgr/dispatcher_spec.rb +4 -4
- data/spec/unit/msgr/test_pool_spec.rb +14 -0
- data/spec/unit/msgr_spec.rb +2 -2
- metadata +8 -60
- data/spec/integration/dummy/db/test.sqlite3 +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d505941f2c4bf678a5d8c5185b2d65c510fcc08aa818eca251e83e8f0225b178
|
|
4
|
+
data.tar.gz: 3f78955ee1074190d7fa63384294ae1b09802fcb362645b2aa52b79062ab9057
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e421518963ac9b653faaab3da418687a96b4a7b91dfd931e7afc8d3166b247c711a2e6eb199bcef6fc0e83d970308b2998a152b80e32b3bc1d7f248af5fd161d
|
|
7
|
+
data.tar.gz: 776b325f75779d39ad2c254020082da70ef4bf5a0dc1ec601c392546472315b29cfc0821718f94491d023077d1d84c7617b15ed808b9fa3f9b2aef1de56dd151
|
data/.github/workflows/test.yml
CHANGED
|
@@ -3,27 +3,31 @@ on: [push]
|
|
|
3
3
|
jobs:
|
|
4
4
|
test:
|
|
5
5
|
name: Ruby ${{ matrix.ruby }} / ${{ matrix.gemfile }}
|
|
6
|
-
runs-on: ubuntu-
|
|
6
|
+
runs-on: ubuntu-22.04
|
|
7
7
|
|
|
8
8
|
strategy:
|
|
9
9
|
matrix:
|
|
10
10
|
ruby:
|
|
11
|
+
- "3.2"
|
|
12
|
+
- "3.1"
|
|
11
13
|
- "3.0"
|
|
12
14
|
- "2.7"
|
|
13
|
-
- "2.6"
|
|
14
|
-
- "2.5"
|
|
15
15
|
gemfile:
|
|
16
16
|
- rails_5.2.gemfile
|
|
17
17
|
- rails_6.0.gemfile
|
|
18
18
|
- rails_6.1.gemfile
|
|
19
19
|
- rails_7.0.gemfile
|
|
20
20
|
exclude:
|
|
21
|
+
- ruby: "3.2"
|
|
22
|
+
gemfile: rails_5.2.gemfile
|
|
23
|
+
- ruby: "3.2"
|
|
24
|
+
gemfile: rails_6.0.gemfile
|
|
25
|
+
- ruby: "3.1"
|
|
26
|
+
gemfile: rails_5.2.gemfile
|
|
27
|
+
- ruby: "3.1"
|
|
28
|
+
gemfile: rails_6.0.gemfile
|
|
21
29
|
- ruby: "3.0"
|
|
22
30
|
gemfile: rails_5.2.gemfile
|
|
23
|
-
- ruby: "2.5"
|
|
24
|
-
gemfile: rails_7.0.gemfile
|
|
25
|
-
- ruby: "2.6"
|
|
26
|
-
gemfile: rails_7.0.gemfile
|
|
27
31
|
fail-fast: False
|
|
28
32
|
|
|
29
33
|
services:
|
|
@@ -61,7 +65,7 @@ jobs:
|
|
|
61
65
|
|
|
62
66
|
rubocop:
|
|
63
67
|
name: rubocop
|
|
64
|
-
runs-on: ubuntu-
|
|
68
|
+
runs-on: ubuntu-22.04
|
|
65
69
|
|
|
66
70
|
env:
|
|
67
71
|
BUNDLE_JOBS: 4
|
data/.gitignore
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
*.rbc
|
|
1
|
+
_yardoc
|
|
3
2
|
.bundle
|
|
4
3
|
.config
|
|
4
|
+
.idea
|
|
5
|
+
.rbx
|
|
6
|
+
.rspec
|
|
5
7
|
.yardoc
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
*.gem
|
|
9
|
+
*.iml
|
|
10
|
+
*.lock
|
|
11
|
+
*.log
|
|
12
|
+
*.rbc
|
|
9
13
|
coverage
|
|
10
14
|
doc/
|
|
15
|
+
InstalledFiles
|
|
11
16
|
lib/bundler/man
|
|
12
17
|
pkg
|
|
18
|
+
pmip
|
|
13
19
|
rdoc
|
|
20
|
+
spec/integration/dummy/.generators
|
|
21
|
+
spec/integration/dummy/.rakeTasks
|
|
22
|
+
spec/integration/dummy/.sass-cache
|
|
23
|
+
spec/integration/dummy/db/*.sqlite3
|
|
24
|
+
spec/integration/dummy/db/*.sqlite3-journal
|
|
25
|
+
spec/integration/dummy/tmp
|
|
14
26
|
spec/reports
|
|
15
27
|
test/tmp
|
|
16
28
|
test/version_tmp
|
|
17
29
|
tmp
|
|
18
|
-
.idea
|
|
19
|
-
pmip
|
|
20
|
-
*.iml
|
|
21
|
-
.rbx
|
|
22
|
-
.rspec
|
|
23
|
-
*.log
|
|
24
|
-
spec/integration/dummy/db/*.sqlite3
|
|
25
|
-
spec/integration/dummy/db/*.sqlite3-journal
|
|
26
|
-
spec/integration/dummy/tmp
|
|
27
|
-
spec/integration/dummy/.sass-cache
|
|
28
|
-
spec/integration/dummy/.generators
|
|
29
|
-
spec/integration/dummy/.rakeTasks
|
data/.markdownlint.yml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# markdownlint config
|
|
2
|
+
|
|
3
|
+
# The CHANGELOG contains duplicated headers by design
|
|
4
|
+
MD024: false
|
|
5
|
+
|
|
6
|
+
# MD013/line-length: disable line length for all. We prefer lines as
|
|
7
|
+
# long as paragraph with in-editor line breaks.
|
|
8
|
+
MD013: false
|
|
9
|
+
|
|
10
|
+
# MD033/no-inline-html: allow often need tags
|
|
11
|
+
MD033:
|
|
12
|
+
allowed_elements:
|
|
13
|
+
- figure
|
|
14
|
+
- figcaption
|
|
15
|
+
|
|
16
|
+
# MD046/code-block-style: code block style conflicting with
|
|
17
|
+
# admonitions...
|
|
18
|
+
MD046: false
|
|
19
|
+
|
|
20
|
+
# MD048/code-fence-style: code fence style
|
|
21
|
+
MD048:
|
|
22
|
+
style: backtick
|
data/.rubocop.yml
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
AMQP
|
data/Appraisals
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
# vim: ft=ruby
|
|
4
4
|
|
|
5
|
-
appraise 'rails-5.2' do
|
|
6
|
-
|
|
7
|
-
end
|
|
5
|
+
# appraise 'rails-5.2' do
|
|
6
|
+
# gem 'rails', '~> 5.2.0'
|
|
7
|
+
# end
|
|
8
8
|
|
|
9
|
-
appraise 'rails-6.0' do
|
|
10
|
-
|
|
11
|
-
end
|
|
9
|
+
# appraise 'rails-6.0' do
|
|
10
|
+
# gem 'rails', '~> 6.0.0'
|
|
11
|
+
# end
|
|
12
12
|
|
|
13
13
|
appraise 'rails-6.1' do
|
|
14
14
|
gem 'rails', '~> 6.1.0'
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [1.5.0] - 2023-08-16
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Support for Ruby 3.1 and 3.2
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- Drop support for Ruby < 2.7
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- `TestPool#run` passing down keyword arguments
|
|
22
|
+
|
|
9
23
|
## [1.4.0] - 2022-01-10
|
|
10
24
|
|
|
11
25
|
### Added
|
|
@@ -48,7 +62,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
48
62
|
|
|
49
63
|
### Changed
|
|
50
64
|
|
|
51
|
-
- Serialize JSON using core JSON instead of MultiJson
|
|
65
|
+
- Serialize JSON using core JSON instead of `MultiJson`
|
|
52
66
|
- Remove application/text fallback for payload (#25)
|
|
53
67
|
|
|
54
68
|
## [1.1.0] - 2018-07-25
|
|
@@ -88,7 +102,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
88
102
|
|
|
89
103
|
### Changed
|
|
90
104
|
|
|
91
|
-
- Rework TestPool timeout handling to not account processing time
|
|
105
|
+
- Rework `TestPool` timeout handling to not account processing time
|
|
92
106
|
|
|
93
107
|
## [0.14.1] - 2016-02-17
|
|
94
108
|
|
|
@@ -124,7 +138,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
124
138
|
|
|
125
139
|
### Added
|
|
126
140
|
|
|
127
|
-
- Add checkcredentials config option to disable initial connect to
|
|
141
|
+
- Add `checkcredentials` config option to disable initial connect to RabbitMQ
|
|
128
142
|
server to check the credentials
|
|
129
143
|
|
|
130
144
|
### Changed
|
|
@@ -135,13 +149,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
135
149
|
|
|
136
150
|
### Added
|
|
137
151
|
|
|
138
|
-
- Add nack for messages when an error is rescued by dispatcher
|
|
152
|
+
- Add `#nack` for messages when an error is rescued by dispatcher
|
|
139
153
|
|
|
140
154
|
## [0.11.0-rc1] - 2014-03-29
|
|
141
155
|
|
|
142
156
|
### Added
|
|
143
157
|
|
|
144
|
-
- Add pool_class config to override pool classes used by dispatcher
|
|
158
|
+
- Add `pool_class` config to override pool classes used by dispatcher
|
|
145
159
|
|
|
146
160
|
## [0.4.1] - 2014-03-18
|
|
147
161
|
|
|
@@ -153,7 +167,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
153
167
|
|
|
154
168
|
### Changed
|
|
155
169
|
|
|
156
|
-
- Improve
|
|
170
|
+
- Improve `Railtie` and autostart code
|
|
157
171
|
|
|
158
172
|
## 0.4.0 - 0.10.0
|
|
159
173
|
|
|
@@ -171,7 +185,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
171
185
|
|
|
172
186
|
### Fixed
|
|
173
187
|
|
|
174
|
-
- Fix wrong
|
|
188
|
+
- Fix wrong Rails initializer code - was not use the config file
|
|
175
189
|
|
|
176
190
|
## [0.2.0] - 2014-02-21
|
|
177
191
|
|
|
@@ -179,7 +193,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
179
193
|
|
|
180
194
|
- Improve rails initializer code
|
|
181
195
|
|
|
182
|
-
[
|
|
196
|
+
[Unreleased]: https://github.com/jgraichen/msgr/compare/v1.5.0...HEAD
|
|
197
|
+
[1.5.0]: https://github.com/jgraichen/msgr/compare/v1.4.0...v1.5.0
|
|
183
198
|
[1.4.0]: https://github.com/jgraichen/msgr/compare/v1.3.2...v1.4.0
|
|
184
199
|
[1.3.2]: https://github.com/jgraichen/msgr/compare/v1.3.1...v1.3.2
|
|
185
200
|
[1.3.1]: https://github.com/jgraichen/msgr/compare/v1.3.0...v1.3.1
|
data/Gemfile
CHANGED
|
@@ -4,11 +4,11 @@ source 'https://rubygems.org'
|
|
|
4
4
|
|
|
5
5
|
gem 'appraisal'
|
|
6
6
|
gem 'coveralls'
|
|
7
|
-
gem 'my-rubocop', github: 'jgraichen/my-rubocop', ref: 'v4'
|
|
8
7
|
gem 'rake'
|
|
9
8
|
gem 'rake-release', '~> 1.1'
|
|
10
9
|
gem 'rspec', '~> 3.0'
|
|
11
10
|
gem 'rspec-rails'
|
|
11
|
+
gem 'rubocop-config', github: 'jgraichen/rubocop-config', ref: 'v11', require: false
|
|
12
12
|
|
|
13
13
|
gem 'rails'
|
|
14
14
|
gem 'sqlite3'
|
data/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Msgr: _Rails-like Messaging Framework_
|
|
2
2
|
|
|
3
3
|
[](https://rubygems.org/gems/msgr)
|
|
4
|
-
[](https://github.com/jgraichen/msgr/actions/workflows/test.yml)
|
|
4
|
+
[](https://github.com/jgraichen/msgr/actions/workflows/test.yml)
|
|
5
5
|
[](http://rubydoc.info/github/jgraichen/msgr/master/frames)
|
|
6
6
|
|
|
7
7
|
You know it and you like it. Using Rails you can just declare your routes and
|
|
@@ -14,19 +14,25 @@ your routes, create your consumer and watch your app processing messages.
|
|
|
14
14
|
|
|
15
15
|
Add this line to your application's Gemfile:
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
```ruby
|
|
18
|
+
gem 'msgr', '~> 1.5'
|
|
19
|
+
```
|
|
18
20
|
|
|
19
21
|
And then execute:
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
```console
|
|
24
|
+
bundle
|
|
25
|
+
```
|
|
22
26
|
|
|
23
27
|
Or install it yourself as:
|
|
24
28
|
|
|
25
|
-
|
|
29
|
+
```console
|
|
30
|
+
gem install msgr
|
|
31
|
+
```
|
|
26
32
|
|
|
27
33
|
## Usage
|
|
28
34
|
|
|
29
|
-
After adding 'msgr' to your
|
|
35
|
+
After adding 'msgr' to your Gemfile create a `config/rabbitmq.yml` like this:
|
|
30
36
|
|
|
31
37
|
```yaml
|
|
32
38
|
common: &common
|
data/gemfiles/rails_5.2.gemfile
CHANGED
data/gemfiles/rails_6.0.gemfile
CHANGED
data/gemfiles/rails_6.1.gemfile
CHANGED
data/gemfiles/rails_7.0.gemfile
CHANGED
data/gemfiles/rails_head.gemfile
CHANGED
data/lib/msgr/cli.rb
CHANGED
data/lib/msgr/connection.rb
CHANGED
|
@@ -87,8 +87,8 @@ module Msgr
|
|
|
87
87
|
def bind(routes)
|
|
88
88
|
if routes.empty?
|
|
89
89
|
log(:warn) do
|
|
90
|
-
"No routes to bound to. Bind will have no effect:\n" \
|
|
91
|
-
"
|
|
90
|
+
"No routes to bound to. Bind will have no effect:\n " \
|
|
91
|
+
"#{routes.inspect}"
|
|
92
92
|
end
|
|
93
93
|
else
|
|
94
94
|
bind_all(routes)
|
data/lib/msgr/test_pool.rb
CHANGED
|
@@ -60,12 +60,12 @@ module Msgr
|
|
|
60
60
|
@instance ||= super(*args) # rubocop:disable Naming/MemoizedInstanceVariableName
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
-
def run(
|
|
64
|
-
new.run(
|
|
63
|
+
def run(**kwargs)
|
|
64
|
+
new.run(**kwargs)
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
def clear
|
|
68
|
-
@instance
|
|
68
|
+
@instance&.clear
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
alias reset clear
|
data/lib/msgr/version.rb
CHANGED
data/msgr.gemspec
CHANGED
|
@@ -21,13 +21,10 @@ Gem::Specification.new do |spec|
|
|
|
21
21
|
|
|
22
22
|
spec.files = `git ls-files -z`.split("\x0")
|
|
23
23
|
spec.executables = spec.files.grep(%r{^bin/}) {|f| File.basename(f) }
|
|
24
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
25
24
|
spec.require_paths = %w[lib]
|
|
26
25
|
|
|
27
|
-
spec.required_ruby_version = '>= 2.
|
|
26
|
+
spec.required_ruby_version = '>= 2.7'
|
|
28
27
|
|
|
29
28
|
spec.add_dependency 'activesupport'
|
|
30
29
|
spec.add_dependency 'bunny', '>= 1.4', '< 3.0'
|
|
31
|
-
|
|
32
|
-
spec.add_development_dependency 'bundler'
|
|
33
30
|
end
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
class TestConsumer < ApplicationConsumer
|
|
4
|
+
class << self
|
|
5
|
+
attr_accessor :queue
|
|
6
|
+
end
|
|
7
|
+
|
|
4
8
|
def index
|
|
5
9
|
data = {fuubar: 'abc'}
|
|
6
10
|
|
|
@@ -8,6 +12,7 @@ class TestConsumer < ApplicationConsumer
|
|
|
8
12
|
end
|
|
9
13
|
|
|
10
14
|
def another_action
|
|
11
|
-
|
|
15
|
+
self.class.queue ||= []
|
|
16
|
+
self.class.queue << payload
|
|
12
17
|
end
|
|
13
18
|
end
|
|
@@ -31,24 +31,23 @@ describe Msgr::Dispatcher do
|
|
|
31
31
|
let(:config) { {max: 1} }
|
|
32
32
|
let(:consumer) { 'DispatcherTestConsumer' }
|
|
33
33
|
let(:route) do
|
|
34
|
-
instance_double(
|
|
35
|
-
allow(t).to
|
|
36
|
-
allow(t).to receive(:action).and_return 'index'
|
|
34
|
+
instance_double(Msgr::Route).tap do |t|
|
|
35
|
+
allow(t).to receive_messages(consumer: consumer, action: 'index')
|
|
37
36
|
end
|
|
38
37
|
end
|
|
39
38
|
let(:channel) do
|
|
40
|
-
instance_double(
|
|
39
|
+
instance_double(Msgr::Channel).tap do |c|
|
|
41
40
|
allow(c).to receive(:ack)
|
|
42
41
|
end
|
|
43
42
|
end
|
|
44
43
|
let(:delivery_info) do
|
|
45
|
-
instance_double(
|
|
44
|
+
instance_double(Bunny::DeliveryInfo).tap do |ti|
|
|
46
45
|
allow(ti).to receive(:delivery_tag).and_return(3)
|
|
47
46
|
end
|
|
48
47
|
end
|
|
49
48
|
let(:payload) { {} }
|
|
50
49
|
let(:metadata) do
|
|
51
|
-
instance_double(
|
|
50
|
+
instance_double(Bunny::MessageProperties).tap do |metadata|
|
|
52
51
|
allow(metadata).to receive(:content_type).and_return('text/plain')
|
|
53
52
|
end
|
|
54
53
|
end
|
|
@@ -11,7 +11,7 @@ Coveralls.wear! do
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
ENV['RAILS_ENV'] ||= 'test'
|
|
14
|
-
ENV['RAILS_GROUPS'] = ['rails', ENV
|
|
14
|
+
ENV['RAILS_GROUPS'] = ['rails', ENV.fetch('RAILS_GROUPS', nil)].compact.join(',')
|
|
15
15
|
require File.expand_path('dummy/config/environment', __dir__)
|
|
16
16
|
require 'rspec/rails'
|
|
17
17
|
|
|
@@ -50,4 +50,10 @@ RSpec.configure do |config|
|
|
|
50
50
|
config.before do
|
|
51
51
|
Msgr.logger = false
|
|
52
52
|
end
|
|
53
|
+
|
|
54
|
+
config.after do
|
|
55
|
+
# Flush the consumer queue
|
|
56
|
+
Msgr.client.stop delete: true
|
|
57
|
+
Msgr::TestPool.reset
|
|
58
|
+
end
|
|
53
59
|
end
|
|
@@ -2,8 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
require 'spec_helper'
|
|
4
4
|
|
|
5
|
-
describe TestController, type: :
|
|
5
|
+
describe TestController, type: :controller do
|
|
6
|
+
before do
|
|
7
|
+
Msgr.client.start
|
|
8
|
+
end
|
|
9
|
+
|
|
6
10
|
it 'sends messages on :index' do
|
|
7
|
-
get
|
|
11
|
+
get :index
|
|
12
|
+
|
|
13
|
+
Msgr::TestPool.run(count: 2)
|
|
14
|
+
|
|
15
|
+
expect(TestConsumer.queue).to eq [{fuubar: 'abc'}]
|
|
8
16
|
end
|
|
9
17
|
end
|
|
@@ -61,8 +61,8 @@ describe Msgr::Client do
|
|
|
61
61
|
subject(:drain) { client.drain }
|
|
62
62
|
|
|
63
63
|
let(:config) { {routing_file: 'spec/fixtures/msgr_routes_test_drain.rb'} }
|
|
64
|
-
let(:channel_stub) { instance_double(
|
|
65
|
-
let(:queue_stub) { instance_double(
|
|
64
|
+
let(:channel_stub) { instance_double(Msgr::Channel, prefetch: true) }
|
|
65
|
+
let(:queue_stub) { instance_double(Bunny::Queue, purge: true) }
|
|
66
66
|
|
|
67
67
|
before do
|
|
68
68
|
allow(Msgr::Channel).to receive(:new).and_return(channel_stub)
|
|
@@ -23,8 +23,8 @@ describe Msgr::Dispatcher do
|
|
|
23
23
|
|
|
24
24
|
describe 'dispatch' do
|
|
25
25
|
it 'acks messages automatically if auto_ack is enabled' do
|
|
26
|
-
route_db = instance_double(
|
|
27
|
-
msg_db = instance_spy(
|
|
26
|
+
route_db = instance_double(Msgr::Route, consumer: 'MsgrAutoAckConsumer', action: :index)
|
|
27
|
+
msg_db = instance_spy(Msgr::Message, route: route_db, acked?: false)
|
|
28
28
|
|
|
29
29
|
dispatcher.dispatch(msg_db)
|
|
30
30
|
|
|
@@ -33,8 +33,8 @@ describe Msgr::Dispatcher do
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
it 'does not ack messages if auto_ack is disabled' do
|
|
36
|
-
route_db = instance_double(
|
|
37
|
-
msg_db = instance_spy(
|
|
36
|
+
route_db = instance_double(Msgr::Route, consumer: 'MsgrManualAckConsumer', action: :index)
|
|
37
|
+
msg_db = instance_spy(Msgr::Message, route: route_db, acked?: false)
|
|
38
38
|
|
|
39
39
|
dispatcher.dispatch(msg_db)
|
|
40
40
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
describe Msgr::TestPool do
|
|
6
|
+
let(:pool) { described_class.new }
|
|
7
|
+
|
|
8
|
+
describe '.run' do
|
|
9
|
+
it 'passes through to #run' do
|
|
10
|
+
expect(pool).to receive(:run).with(count: 5) # rubocop:disable RSpec/MessageSpies
|
|
11
|
+
described_class.run(count: 5)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
data/spec/unit/msgr_spec.rb
CHANGED
|
@@ -24,7 +24,7 @@ end
|
|
|
24
24
|
|
|
25
25
|
describe Msgr do
|
|
26
26
|
let(:queue) { Queue.new }
|
|
27
|
-
let(:client) { Msgr::Client.new size: 1, prefix: SecureRandom.hex(2), uri: ENV
|
|
27
|
+
let(:client) { Msgr::Client.new size: 1, prefix: SecureRandom.hex(2), uri: ENV.fetch('AMQP_SERVER', nil) }
|
|
28
28
|
|
|
29
29
|
before do
|
|
30
30
|
client.routes.configure do
|
|
@@ -85,7 +85,7 @@ describe Msgr do
|
|
|
85
85
|
# Test whether the nacked message gets redelivered. In this case, it was not acked when acknowledging the other message
|
|
86
86
|
message = Timeout.timeout(4) { queue.pop }
|
|
87
87
|
expect(message.payload).to eq(messages[0].payload)
|
|
88
|
-
expect(message.delivery_info.redelivered).to
|
|
88
|
+
expect(message.delivery_info.redelivered).to be(true)
|
|
89
89
|
|
|
90
90
|
expect(Receiver).to have_received(:batch).exactly(3).times
|
|
91
91
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: msgr
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jan Graichen
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-08-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -44,20 +44,6 @@ dependencies:
|
|
|
44
44
|
- - "<"
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
46
|
version: '3.0'
|
|
47
|
-
- !ruby/object:Gem::Dependency
|
|
48
|
-
name: bundler
|
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
|
50
|
-
requirements:
|
|
51
|
-
- - ">="
|
|
52
|
-
- !ruby/object:Gem::Version
|
|
53
|
-
version: '0'
|
|
54
|
-
type: :development
|
|
55
|
-
prerelease: false
|
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
-
requirements:
|
|
58
|
-
- - ">="
|
|
59
|
-
- !ruby/object:Gem::Version
|
|
60
|
-
version: '0'
|
|
61
47
|
description: 'Msgr: Rails-like Messaging Framework'
|
|
62
48
|
email:
|
|
63
49
|
- jgraichen@altimos.de
|
|
@@ -69,7 +55,9 @@ files:
|
|
|
69
55
|
- ".editorconfig"
|
|
70
56
|
- ".github/workflows/test.yml"
|
|
71
57
|
- ".gitignore"
|
|
58
|
+
- ".markdownlint.yml"
|
|
72
59
|
- ".rubocop.yml"
|
|
60
|
+
- ".vscode/ltex.dictionary.en-US.txt"
|
|
73
61
|
- Appraisals
|
|
74
62
|
- CHANGELOG.md
|
|
75
63
|
- Gemfile
|
|
@@ -123,7 +111,6 @@ files:
|
|
|
123
111
|
- spec/integration/dummy/config/rabbitmq.yml
|
|
124
112
|
- spec/integration/dummy/config/routes.rb
|
|
125
113
|
- spec/integration/dummy/config/secrets.yml
|
|
126
|
-
- spec/integration/dummy/db/test.sqlite3
|
|
127
114
|
- spec/integration/dummy/log/.keep
|
|
128
115
|
- spec/integration/dummy/public/404.html
|
|
129
116
|
- spec/integration/dummy/public/422.html
|
|
@@ -139,6 +126,7 @@ files:
|
|
|
139
126
|
- spec/unit/msgr/dispatcher_spec.rb
|
|
140
127
|
- spec/unit/msgr/route_spec.rb
|
|
141
128
|
- spec/unit/msgr/routes_spec.rb
|
|
129
|
+
- spec/unit/msgr/test_pool_spec.rb
|
|
142
130
|
- spec/unit/msgr_spec.rb
|
|
143
131
|
- spec/unit/spec_helper.rb
|
|
144
132
|
- spec/unit/support/.keep
|
|
@@ -155,55 +143,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
155
143
|
requirements:
|
|
156
144
|
- - ">="
|
|
157
145
|
- !ruby/object:Gem::Version
|
|
158
|
-
version: '2.
|
|
146
|
+
version: '2.7'
|
|
159
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
160
148
|
requirements:
|
|
161
149
|
- - ">="
|
|
162
150
|
- !ruby/object:Gem::Version
|
|
163
151
|
version: '0'
|
|
164
152
|
requirements: []
|
|
165
|
-
rubygems_version: 3.
|
|
153
|
+
rubygems_version: 3.4.18
|
|
166
154
|
signing_key:
|
|
167
155
|
specification_version: 4
|
|
168
156
|
summary: 'Msgr: Rails-like Messaging Framework'
|
|
169
|
-
test_files:
|
|
170
|
-
- spec/fixtures/msgr_routes_test_1.rb
|
|
171
|
-
- spec/fixtures/msgr_routes_test_drain.rb
|
|
172
|
-
- spec/integration/dummy/Rakefile
|
|
173
|
-
- spec/integration/dummy/app/assets/config/manifest.js
|
|
174
|
-
- spec/integration/dummy/app/consumers/application_consumer.rb
|
|
175
|
-
- spec/integration/dummy/app/consumers/test_consumer.rb
|
|
176
|
-
- spec/integration/dummy/app/controllers/application_controller.rb
|
|
177
|
-
- spec/integration/dummy/app/controllers/test_controller.rb
|
|
178
|
-
- spec/integration/dummy/app/helpers/application_helper.rb
|
|
179
|
-
- spec/integration/dummy/bin/bundle
|
|
180
|
-
- spec/integration/dummy/bin/rails
|
|
181
|
-
- spec/integration/dummy/bin/rake
|
|
182
|
-
- spec/integration/dummy/config.ru
|
|
183
|
-
- spec/integration/dummy/config/application.rb
|
|
184
|
-
- spec/integration/dummy/config/boot.rb
|
|
185
|
-
- spec/integration/dummy/config/database.yml
|
|
186
|
-
- spec/integration/dummy/config/environment.rb
|
|
187
|
-
- spec/integration/dummy/config/msgr.rb
|
|
188
|
-
- spec/integration/dummy/config/rabbitmq.yml
|
|
189
|
-
- spec/integration/dummy/config/routes.rb
|
|
190
|
-
- spec/integration/dummy/config/secrets.yml
|
|
191
|
-
- spec/integration/dummy/db/test.sqlite3
|
|
192
|
-
- spec/integration/dummy/log/.keep
|
|
193
|
-
- spec/integration/dummy/public/404.html
|
|
194
|
-
- spec/integration/dummy/public/422.html
|
|
195
|
-
- spec/integration/dummy/public/500.html
|
|
196
|
-
- spec/integration/dummy/public/favicon.ico
|
|
197
|
-
- spec/integration/msgr/dispatcher_spec.rb
|
|
198
|
-
- spec/integration/msgr/railtie_spec.rb
|
|
199
|
-
- spec/integration/spec_helper.rb
|
|
200
|
-
- spec/integration/test_controller_spec.rb
|
|
201
|
-
- spec/unit/msgr/client_spec.rb
|
|
202
|
-
- spec/unit/msgr/connection_spec.rb
|
|
203
|
-
- spec/unit/msgr/consumer_spec.rb
|
|
204
|
-
- spec/unit/msgr/dispatcher_spec.rb
|
|
205
|
-
- spec/unit/msgr/route_spec.rb
|
|
206
|
-
- spec/unit/msgr/routes_spec.rb
|
|
207
|
-
- spec/unit/msgr_spec.rb
|
|
208
|
-
- spec/unit/spec_helper.rb
|
|
209
|
-
- spec/unit/support/.keep
|
|
157
|
+
test_files: []
|
|
File without changes
|