msgr 1.4.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/maintenance-cache-wipe.yml +13 -0
- data/.github/workflows/maintenance-workflow-cleanup.yml +17 -0
- data/.github/workflows/release.yml +36 -0
- data/.github/workflows/test.yml +22 -14
- 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 +11 -11
- data/CHANGELOG.md +30 -8
- data/Gemfile +6 -3
- data/README.md +11 -5
- data/gemfiles/rails_6.1.gemfile +4 -3
- data/gemfiles/rails_7.0.gemfile +5 -4
- data/gemfiles/rails_7.1.gemfile +16 -0
- data/gemfiles/rails_7.2.gemfile +16 -0
- data/lib/msgr/cli.rb +2 -2
- data/lib/msgr/connection.rb +2 -2
- data/lib/msgr/test_pool.rb +4 -4
- data/lib/msgr/version.rb +2 -2
- data/msgr.gemspec +1 -4
- data/spec/integration/dummy/app/consumers/test_consumer.rb +7 -2
- data/spec/integration/dummy/config/rabbitmq.yml +2 -0
- data/spec/integration/msgr/dispatcher_spec.rb +5 -6
- data/spec/integration/spec_helper.rb +18 -9
- 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
- data/spec/unit/spec_helper.rb +10 -7
- metadata +16 -66
- data/gemfiles/rails_5.2.gemfile +0 -15
- data/gemfiles/rails_6.0.gemfile +0 -15
- data/gemfiles/rails_head.gemfile +0 -15
- 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: b69f99b675987fb9acd292af1603a5806167aac39e49a98cd629a18cb03ef8f5
|
4
|
+
data.tar.gz: 41c53127e3fb1aee3efa28a107fd5d3b08baf99754582aef2415f6ee227676e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94753aaa39cb6be26a78962cd29fe0ad2fe922d117b85718b3a523fff032868f4b0e3ec9ac66d00e60cd0d561a2ba412cdf693c1eb736cf05201881d0e44664e
|
7
|
+
data.tar.gz: af7cc8d4e7d0ece9c03c673587797ed9d26412e83e3d96af1b41da872105dced4c7b2ad1a30d4dd95a91d3315b90cc2bb17845dba178fa51f76507665fb62c4a
|
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
name: maintenance-workflow-cleanup
|
3
|
+
on:
|
4
|
+
schedule:
|
5
|
+
- cron: "0 0 1 * *"
|
6
|
+
workflow_dispatch:
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
delete-workflow-runs:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
steps:
|
12
|
+
- uses: Mattraks/delete-workflow-runs@v2
|
13
|
+
with:
|
14
|
+
token: ${{ github.token }}
|
15
|
+
repository: ${{ github.repository }}
|
16
|
+
retain_days: 180
|
17
|
+
keep_minimum_runs: 50
|
@@ -0,0 +1,36 @@
|
|
1
|
+
name: release
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- v*
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
rubygems:
|
10
|
+
if: github.repository == 'jgraichen/msgr'
|
11
|
+
runs-on: ubuntu-24.04
|
12
|
+
|
13
|
+
permissions:
|
14
|
+
contents: write
|
15
|
+
id-token: write
|
16
|
+
|
17
|
+
env:
|
18
|
+
BUNDLE_JOBS: 4
|
19
|
+
BUNDLE_RETRY: 10
|
20
|
+
BUNDLE_WITHOUT: development test
|
21
|
+
|
22
|
+
steps:
|
23
|
+
- uses: actions/checkout@v4
|
24
|
+
|
25
|
+
- uses: ruby/setup-ruby@v1
|
26
|
+
with:
|
27
|
+
ruby-version: ruby
|
28
|
+
bundler-cache: true
|
29
|
+
|
30
|
+
- uses: rubygems/release-gem@v1
|
31
|
+
|
32
|
+
- uses: taiki-e/create-gh-release-action@v1
|
33
|
+
with:
|
34
|
+
changelog: CHANGELOG.md
|
35
|
+
draft: true
|
36
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
data/.github/workflows/test.yml
CHANGED
@@ -3,27 +3,30 @@ on: [push]
|
|
3
3
|
jobs:
|
4
4
|
test:
|
5
5
|
name: Ruby ${{ matrix.ruby }} / ${{ matrix.gemfile }}
|
6
|
-
runs-on: ubuntu-
|
6
|
+
runs-on: ubuntu-24.04
|
7
7
|
|
8
8
|
strategy:
|
9
9
|
matrix:
|
10
10
|
ruby:
|
11
|
+
- "3.3"
|
12
|
+
- "3.2"
|
13
|
+
- "3.1"
|
11
14
|
- "3.0"
|
12
15
|
- "2.7"
|
13
|
-
- "2.6"
|
14
|
-
- "2.5"
|
15
16
|
gemfile:
|
16
|
-
-
|
17
|
-
-
|
18
|
-
- rails_6.1.gemfile
|
17
|
+
- rails_7.2.gemfile
|
18
|
+
- rails_7.1.gemfile
|
19
19
|
- rails_7.0.gemfile
|
20
|
+
- rails_6.1.gemfile
|
20
21
|
exclude:
|
21
|
-
-
|
22
|
-
|
23
|
-
-
|
24
|
-
|
25
|
-
-
|
26
|
-
|
22
|
+
- gemfile: rails_7.2.gemfile
|
23
|
+
ruby: "3.0"
|
24
|
+
- gemfile: rails_7.2.gemfile
|
25
|
+
ruby: "2.7"
|
26
|
+
- gemfile: rails_7.1.gemfile
|
27
|
+
ruby: "3.0"
|
28
|
+
- gemfile: rails_7.1.gemfile
|
29
|
+
ruby: "2.7"
|
27
30
|
fail-fast: False
|
28
31
|
|
29
32
|
services:
|
@@ -59,9 +62,14 @@ jobs:
|
|
59
62
|
- name: Run integration tests
|
60
63
|
run: bundle exec rspec -Ispec/integration --color spec/integration
|
61
64
|
|
65
|
+
- uses: codecov/codecov-action@v4
|
66
|
+
with:
|
67
|
+
fail_ci_if_error: true
|
68
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
69
|
+
|
62
70
|
rubocop:
|
63
71
|
name: rubocop
|
64
|
-
runs-on: ubuntu-
|
72
|
+
runs-on: ubuntu-24.04
|
65
73
|
|
66
74
|
env:
|
67
75
|
BUNDLE_JOBS: 4
|
@@ -72,7 +80,7 @@ jobs:
|
|
72
80
|
- uses: actions/checkout@master
|
73
81
|
- uses: ruby/setup-ruby@v1
|
74
82
|
with:
|
75
|
-
ruby-version: 3.
|
83
|
+
ruby-version: "3.3"
|
76
84
|
bundler-cache: true
|
77
85
|
|
78
86
|
- name: Run rubocop
|
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*
|
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,22 +2,22 @@
|
|
2
2
|
|
3
3
|
# vim: ft=ruby
|
4
4
|
|
5
|
-
appraise 'rails-5.2' do
|
6
|
-
gem 'rails', '~> 5.2.0'
|
7
|
-
end
|
8
|
-
|
9
|
-
appraise 'rails-6.0' do
|
10
|
-
gem 'rails', '~> 6.0.0'
|
11
|
-
end
|
12
|
-
|
13
5
|
appraise 'rails-6.1' do
|
14
6
|
gem 'rails', '~> 6.1.0'
|
7
|
+
gem 'sqlite3', '~> 1.4'
|
15
8
|
end
|
16
9
|
|
17
10
|
appraise 'rails-7.0' do
|
18
|
-
gem 'rails', '~>
|
11
|
+
gem 'rails', '~> 7.0.0'
|
12
|
+
gem 'sqlite3', '~> 1.4'
|
13
|
+
end
|
14
|
+
|
15
|
+
appraise 'rails-7.1' do
|
16
|
+
gem 'rails', '~> 7.1.0'
|
17
|
+
gem 'sqlite3', '~> 2.0'
|
19
18
|
end
|
20
19
|
|
21
|
-
appraise 'rails-
|
22
|
-
gem 'rails',
|
20
|
+
appraise 'rails-7.2' do
|
21
|
+
gem 'rails', '~> 7.2.0'
|
22
|
+
gem 'sqlite3', '~> 2.0'
|
23
23
|
end
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,26 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [1.6.0] - 2024-10-04
|
10
|
+
|
11
|
+
### Added
|
12
|
+
|
13
|
+
- Support for Ruby 3.3
|
14
|
+
|
15
|
+
## [1.5.0] - 2023-08-16
|
16
|
+
|
17
|
+
### Added
|
18
|
+
|
19
|
+
- Support for Ruby 3.1 and 3.2
|
20
|
+
|
21
|
+
### Changed
|
22
|
+
|
23
|
+
- Drop support for Ruby < 2.7
|
24
|
+
|
25
|
+
### Fixed
|
26
|
+
|
27
|
+
- `TestPool#run` passing down keyword arguments
|
28
|
+
|
9
29
|
## [1.4.0] - 2022-01-10
|
10
30
|
|
11
31
|
### Added
|
@@ -48,7 +68,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
48
68
|
|
49
69
|
### Changed
|
50
70
|
|
51
|
-
- Serialize JSON using core JSON instead of MultiJson
|
71
|
+
- Serialize JSON using core JSON instead of `MultiJson`
|
52
72
|
- Remove application/text fallback for payload (#25)
|
53
73
|
|
54
74
|
## [1.1.0] - 2018-07-25
|
@@ -88,7 +108,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
88
108
|
|
89
109
|
### Changed
|
90
110
|
|
91
|
-
- Rework TestPool timeout handling to not account processing time
|
111
|
+
- Rework `TestPool` timeout handling to not account processing time
|
92
112
|
|
93
113
|
## [0.14.1] - 2016-02-17
|
94
114
|
|
@@ -124,7 +144,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
124
144
|
|
125
145
|
### Added
|
126
146
|
|
127
|
-
- Add checkcredentials config option to disable initial connect to
|
147
|
+
- Add `checkcredentials` config option to disable initial connect to RabbitMQ
|
128
148
|
server to check the credentials
|
129
149
|
|
130
150
|
### Changed
|
@@ -135,13 +155,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
135
155
|
|
136
156
|
### Added
|
137
157
|
|
138
|
-
- Add nack for messages when an error is rescued by dispatcher
|
158
|
+
- Add `#nack` for messages when an error is rescued by dispatcher
|
139
159
|
|
140
160
|
## [0.11.0-rc1] - 2014-03-29
|
141
161
|
|
142
162
|
### Added
|
143
163
|
|
144
|
-
- Add pool_class config to override pool classes used by dispatcher
|
164
|
+
- Add `pool_class` config to override pool classes used by dispatcher
|
145
165
|
|
146
166
|
## [0.4.1] - 2014-03-18
|
147
167
|
|
@@ -153,7 +173,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
153
173
|
|
154
174
|
### Changed
|
155
175
|
|
156
|
-
- Improve
|
176
|
+
- Improve `Railtie` and autostart code
|
157
177
|
|
158
178
|
## 0.4.0 - 0.10.0
|
159
179
|
|
@@ -171,7 +191,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
171
191
|
|
172
192
|
### Fixed
|
173
193
|
|
174
|
-
- Fix wrong
|
194
|
+
- Fix wrong Rails initializer code - was not use the config file
|
175
195
|
|
176
196
|
## [0.2.0] - 2014-02-21
|
177
197
|
|
@@ -179,7 +199,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
179
199
|
|
180
200
|
- Improve rails initializer code
|
181
201
|
|
182
|
-
[
|
202
|
+
[Unreleased]: https://github.com/jgraichen/msgr/compare/v1.6.0...HEAD
|
203
|
+
[1.6.0]: https://github.com/jgraichen/msgr/compare/v1.5.0...v1.6.0
|
204
|
+
[1.5.0]: https://github.com/jgraichen/msgr/compare/v1.4.0...v1.5.0
|
183
205
|
[1.4.0]: https://github.com/jgraichen/msgr/compare/v1.3.2...v1.4.0
|
184
206
|
[1.3.2]: https://github.com/jgraichen/msgr/compare/v1.3.1...v1.3.2
|
185
207
|
[1.3.1]: https://github.com/jgraichen/msgr/compare/v1.3.0...v1.3.1
|
data/Gemfile
CHANGED
@@ -3,15 +3,18 @@
|
|
3
3
|
source 'https://rubygems.org'
|
4
4
|
|
5
5
|
gem 'appraisal'
|
6
|
-
gem 'coveralls'
|
7
|
-
gem 'my-rubocop', github: 'jgraichen/my-rubocop', ref: 'v4'
|
8
6
|
gem 'rake'
|
9
7
|
gem 'rake-release', '~> 1.1'
|
8
|
+
|
10
9
|
gem 'rspec', '~> 3.0'
|
11
10
|
gem 'rspec-rails'
|
12
11
|
|
12
|
+
gem 'simplecov', require: false
|
13
|
+
gem 'simplecov-cobertura', require: false
|
14
|
+
|
15
|
+
gem 'rubocop-config', github: 'jgraichen/rubocop-config', ref: 'v12', require: false
|
16
|
+
|
13
17
|
gem 'rails'
|
14
|
-
gem 'sqlite3'
|
15
18
|
|
16
19
|
# Specify your gem's dependencies in acfs.gemspec
|
17
20
|
gemspec
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Msgr: _Rails-like Messaging Framework_
|
2
2
|
|
3
3
|
[![Gem](https://img.shields.io/gem/v/msgr?logo=rubygems)](https://rubygems.org/gems/msgr)
|
4
|
-
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/jgraichen/msgr/test?logo=github)](https://github.com/jgraichen/msgr/actions/workflows/test.yml)
|
4
|
+
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/jgraichen/msgr/test.yml?branch=main&logo=github)](https://github.com/jgraichen/msgr/actions/workflows/test.yml)
|
5
5
|
[![RubyDoc Documentation](http://img.shields.io/badge/rubydoc-here-blue.svg)](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_6.1.gemfile
CHANGED
@@ -3,13 +3,14 @@
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
5
|
gem "appraisal"
|
6
|
-
gem "coveralls"
|
7
|
-
gem "my-rubocop", github: "jgraichen/my-rubocop", ref: "v3"
|
8
6
|
gem "rake"
|
9
7
|
gem "rake-release", "~> 1.1"
|
10
8
|
gem "rspec", "~> 3.0"
|
11
9
|
gem "rspec-rails"
|
10
|
+
gem "simplecov", require: false
|
11
|
+
gem "simplecov-cobertura", require: false
|
12
|
+
gem "rubocop-config", github: "jgraichen/rubocop-config", ref: "v12", require: false
|
12
13
|
gem "rails", "~> 6.1.0"
|
13
|
-
gem "sqlite3"
|
14
|
+
gem "sqlite3", "~> 1.4"
|
14
15
|
|
15
16
|
gemspec path: "../"
|
data/gemfiles/rails_7.0.gemfile
CHANGED
@@ -3,13 +3,14 @@
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
5
|
gem "appraisal"
|
6
|
-
gem "coveralls"
|
7
|
-
gem "my-rubocop", github: "jgraichen/my-rubocop", ref: "v3"
|
8
6
|
gem "rake"
|
9
7
|
gem "rake-release", "~> 1.1"
|
10
8
|
gem "rspec", "~> 3.0"
|
11
9
|
gem "rspec-rails"
|
12
|
-
gem "
|
13
|
-
gem "
|
10
|
+
gem "simplecov", require: false
|
11
|
+
gem "simplecov-cobertura", require: false
|
12
|
+
gem "rubocop-config", github: "jgraichen/rubocop-config", ref: "v12", require: false
|
13
|
+
gem "rails", "~> 7.0.0"
|
14
|
+
gem "sqlite3", "~> 1.4"
|
14
15
|
|
15
16
|
gemspec path: "../"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "appraisal"
|
6
|
+
gem "rake"
|
7
|
+
gem "rake-release", "~> 1.1"
|
8
|
+
gem "rspec", "~> 3.0"
|
9
|
+
gem "rspec-rails"
|
10
|
+
gem "simplecov", require: false
|
11
|
+
gem "simplecov-cobertura", require: false
|
12
|
+
gem "rubocop-config", github: "jgraichen/rubocop-config", ref: "v12", require: false
|
13
|
+
gem "rails", "~> 7.1.0"
|
14
|
+
gem "sqlite3", "~> 2.0"
|
15
|
+
|
16
|
+
gemspec path: "../"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "appraisal"
|
6
|
+
gem "rake"
|
7
|
+
gem "rake-release", "~> 1.1"
|
8
|
+
gem "rspec", "~> 3.0"
|
9
|
+
gem "rspec-rails"
|
10
|
+
gem "simplecov", require: false
|
11
|
+
gem "simplecov-cobertura", require: false
|
12
|
+
gem "rubocop-config", github: "jgraichen/rubocop-config", ref: "v12", require: false
|
13
|
+
gem "rails", "~> 7.2.0"
|
14
|
+
gem "sqlite3", "~> 2.0"
|
15
|
+
|
16
|
+
gemspec path: "../"
|
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
@@ -57,15 +57,15 @@ module Msgr
|
|
57
57
|
|
58
58
|
class << self
|
59
59
|
def new(*args)
|
60
|
-
@instance ||= super
|
60
|
+
@instance ||= super # 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,13 +1,18 @@
|
|
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
|
|
7
|
-
publish
|
11
|
+
publish(data, to: 'local.test.another_action')
|
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
|
@@ -4,14 +4,21 @@
|
|
4
4
|
require 'bundler'
|
5
5
|
Bundler.require :rails, :test
|
6
6
|
|
7
|
-
|
8
|
-
require '
|
9
|
-
|
7
|
+
require 'simplecov'
|
8
|
+
require 'simplecov-cobertura'
|
9
|
+
|
10
|
+
SimpleCov.start do
|
11
|
+
command_name 'rspec:integration'
|
10
12
|
add_filter 'spec'
|
13
|
+
|
14
|
+
self.formatters = [
|
15
|
+
SimpleCov::Formatter::HTMLFormatter,
|
16
|
+
SimpleCov::Formatter::CoberturaFormatter,
|
17
|
+
]
|
11
18
|
end
|
12
19
|
|
13
20
|
ENV['RAILS_ENV'] ||= 'test'
|
14
|
-
ENV['RAILS_GROUPS'] = ['rails', ENV
|
21
|
+
ENV['RAILS_GROUPS'] = ['rails', ENV.fetch('RAILS_GROUPS', nil)].compact.join(',')
|
15
22
|
require File.expand_path('dummy/config/environment', __dir__)
|
16
23
|
require 'rspec/rails'
|
17
24
|
|
@@ -19,9 +26,9 @@ require 'rspec/rails'
|
|
19
26
|
# in spec/support/ and its subdirectories.
|
20
27
|
Dir[File.expand_path('support/**/*.rb', __dir__)].sort.each {|f| require f }
|
21
28
|
|
22
|
-
|
23
|
-
|
24
|
-
|
29
|
+
if ActiveRecord::Migration.respond_to?(:check_all_pending!)
|
30
|
+
ActiveRecord::Migration.check_all_pending!
|
31
|
+
else
|
25
32
|
ActiveRecord::Migration.check_pending!
|
26
33
|
end
|
27
34
|
|
@@ -47,7 +54,9 @@ RSpec.configure do |config|
|
|
47
54
|
c.syntax = :expect
|
48
55
|
end
|
49
56
|
|
50
|
-
config.
|
51
|
-
|
57
|
+
config.after do
|
58
|
+
# Flush the consumer queue
|
59
|
+
Msgr.client.stop delete: true
|
60
|
+
Msgr::TestPool.reset
|
52
61
|
end
|
53
62
|
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
|
data/spec/unit/spec_helper.rb
CHANGED
@@ -4,10 +4,17 @@
|
|
4
4
|
require 'bundler'
|
5
5
|
Bundler.setup :default, :test
|
6
6
|
|
7
|
-
|
8
|
-
require '
|
9
|
-
|
7
|
+
require 'simplecov'
|
8
|
+
require 'simplecov-cobertura'
|
9
|
+
|
10
|
+
SimpleCov.start do
|
11
|
+
command_name 'rspec:unit'
|
10
12
|
add_filter 'spec'
|
13
|
+
|
14
|
+
self.formatters = [
|
15
|
+
SimpleCov::Formatter::HTMLFormatter,
|
16
|
+
SimpleCov::Formatter::CoberturaFormatter,
|
17
|
+
]
|
11
18
|
end
|
12
19
|
|
13
20
|
require 'msgr'
|
@@ -20,8 +27,4 @@ RSpec.configure do |config|
|
|
20
27
|
# Only allow expect syntax
|
21
28
|
c.syntax = :expect
|
22
29
|
end
|
23
|
-
|
24
|
-
config.before do
|
25
|
-
Msgr.logger = false
|
26
|
-
end
|
27
30
|
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.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Graichen
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-10-04 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
|
@@ -67,9 +53,14 @@ extensions: []
|
|
67
53
|
extra_rdoc_files: []
|
68
54
|
files:
|
69
55
|
- ".editorconfig"
|
56
|
+
- ".github/workflows/maintenance-cache-wipe.yml"
|
57
|
+
- ".github/workflows/maintenance-workflow-cleanup.yml"
|
58
|
+
- ".github/workflows/release.yml"
|
70
59
|
- ".github/workflows/test.yml"
|
71
60
|
- ".gitignore"
|
61
|
+
- ".markdownlint.yml"
|
72
62
|
- ".rubocop.yml"
|
63
|
+
- ".vscode/ltex.dictionary.en-US.txt"
|
73
64
|
- Appraisals
|
74
65
|
- CHANGELOG.md
|
75
66
|
- Gemfile
|
@@ -77,11 +68,10 @@ files:
|
|
77
68
|
- README.md
|
78
69
|
- Rakefile
|
79
70
|
- bin/msgr
|
80
|
-
- gemfiles/rails_5.2.gemfile
|
81
|
-
- gemfiles/rails_6.0.gemfile
|
82
71
|
- gemfiles/rails_6.1.gemfile
|
83
72
|
- gemfiles/rails_7.0.gemfile
|
84
|
-
- gemfiles/
|
73
|
+
- gemfiles/rails_7.1.gemfile
|
74
|
+
- gemfiles/rails_7.2.gemfile
|
85
75
|
- lib/msgr.rb
|
86
76
|
- lib/msgr/binding.rb
|
87
77
|
- lib/msgr/channel.rb
|
@@ -123,7 +113,6 @@ files:
|
|
123
113
|
- spec/integration/dummy/config/rabbitmq.yml
|
124
114
|
- spec/integration/dummy/config/routes.rb
|
125
115
|
- spec/integration/dummy/config/secrets.yml
|
126
|
-
- spec/integration/dummy/db/test.sqlite3
|
127
116
|
- spec/integration/dummy/log/.keep
|
128
117
|
- spec/integration/dummy/public/404.html
|
129
118
|
- spec/integration/dummy/public/422.html
|
@@ -139,6 +128,7 @@ files:
|
|
139
128
|
- spec/unit/msgr/dispatcher_spec.rb
|
140
129
|
- spec/unit/msgr/route_spec.rb
|
141
130
|
- spec/unit/msgr/routes_spec.rb
|
131
|
+
- spec/unit/msgr/test_pool_spec.rb
|
142
132
|
- spec/unit/msgr_spec.rb
|
143
133
|
- spec/unit/spec_helper.rb
|
144
134
|
- spec/unit/support/.keep
|
@@ -147,7 +137,7 @@ licenses:
|
|
147
137
|
- MIT
|
148
138
|
metadata:
|
149
139
|
rubygems_mfa_required: 'true'
|
150
|
-
post_install_message:
|
140
|
+
post_install_message:
|
151
141
|
rdoc_options: []
|
152
142
|
require_paths:
|
153
143
|
- lib
|
@@ -155,55 +145,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
155
145
|
requirements:
|
156
146
|
- - ">="
|
157
147
|
- !ruby/object:Gem::Version
|
158
|
-
version: '2.
|
148
|
+
version: '2.7'
|
159
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
150
|
requirements:
|
161
151
|
- - ">="
|
162
152
|
- !ruby/object:Gem::Version
|
163
153
|
version: '0'
|
164
154
|
requirements: []
|
165
|
-
rubygems_version: 3.
|
166
|
-
signing_key:
|
155
|
+
rubygems_version: 3.5.16
|
156
|
+
signing_key:
|
167
157
|
specification_version: 4
|
168
158
|
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
|
159
|
+
test_files: []
|
data/gemfiles/rails_5.2.gemfile
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "appraisal"
|
6
|
-
gem "coveralls"
|
7
|
-
gem "my-rubocop", github: "jgraichen/my-rubocop", ref: "v3"
|
8
|
-
gem "rake"
|
9
|
-
gem "rake-release", "~> 1.1"
|
10
|
-
gem "rspec", "~> 3.0"
|
11
|
-
gem "rspec-rails"
|
12
|
-
gem "rails", "~> 5.2.0"
|
13
|
-
gem "sqlite3"
|
14
|
-
|
15
|
-
gemspec path: "../"
|
data/gemfiles/rails_6.0.gemfile
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "appraisal"
|
6
|
-
gem "coveralls"
|
7
|
-
gem "my-rubocop", github: "jgraichen/my-rubocop", ref: "v3"
|
8
|
-
gem "rake"
|
9
|
-
gem "rake-release", "~> 1.1"
|
10
|
-
gem "rspec", "~> 3.0"
|
11
|
-
gem "rspec-rails"
|
12
|
-
gem "rails", "~> 6.0.0"
|
13
|
-
gem "sqlite3"
|
14
|
-
|
15
|
-
gemspec path: "../"
|
data/gemfiles/rails_head.gemfile
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "appraisal"
|
6
|
-
gem "coveralls"
|
7
|
-
gem "my-rubocop", github: "jgraichen/my-rubocop", ref: "v3"
|
8
|
-
gem "rake"
|
9
|
-
gem "rake-release", "~> 1.1"
|
10
|
-
gem "rspec", "~> 3.0"
|
11
|
-
gem "rspec-rails"
|
12
|
-
gem "rails", git: "https://github.com/rails/rails", require: "rails"
|
13
|
-
gem "sqlite3"
|
14
|
-
|
15
|
-
gemspec path: "../"
|
File without changes
|