msgr 1.1.0.1.b302 → 1.3.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 +4 -4
- data/.editorconfig +8 -0
- data/.github/workflows/build.yml +52 -0
- data/.github/workflows/lint.yml +20 -0
- data/.rubocop.yml +9 -48
- data/.travis.yml +21 -35
- data/Appraisals +18 -0
- data/CHANGELOG.md +29 -11
- data/Gemfile +9 -15
- data/README.md +8 -20
- data/Rakefile +10 -6
- data/bin/msgr +1 -0
- data/gemfiles/rails_5.2.gemfile +14 -0
- data/gemfiles/rails_6.0.gemfile +14 -0
- data/gemfiles/rails_6.1.gemfile +14 -0
- data/gemfiles/rails_master.gemfile +14 -0
- data/lib/msgr.rb +1 -0
- data/lib/msgr/binding.rb +13 -8
- data/lib/msgr/channel.rb +5 -3
- data/lib/msgr/cli.rb +18 -11
- data/lib/msgr/client.rb +17 -20
- data/lib/msgr/connection.rb +13 -1
- data/lib/msgr/consumer.rb +2 -3
- data/lib/msgr/dispatcher.rb +7 -9
- data/lib/msgr/logging.rb +2 -0
- data/lib/msgr/message.rb +1 -2
- data/lib/msgr/railtie.rb +14 -75
- data/lib/msgr/route.rb +1 -4
- data/lib/msgr/routes.rb +2 -0
- data/lib/msgr/tasks/msgr/drain.rake +11 -0
- data/lib/msgr/test_pool.rb +1 -3
- data/lib/msgr/version.rb +2 -2
- data/msgr.gemspec +2 -6
- data/scripts/simple_test.rb +2 -3
- data/spec/fixtures/{msgr-routes-test-1.rb → msgr_routes_test_1.rb} +0 -0
- data/spec/integration/dummy/Rakefile +1 -1
- data/spec/{msgr/support/.keep → integration/dummy/app/assets/config/manifest.js} +0 -0
- data/spec/integration/dummy/bin/bundle +1 -1
- data/spec/integration/dummy/bin/rails +1 -1
- data/spec/integration/dummy/config/application.rb +1 -1
- data/spec/integration/dummy/config/boot.rb +2 -2
- data/spec/integration/dummy/config/environment.rb +1 -1
- data/spec/integration/dummy/config/rabbitmq.yml +1 -1
- data/spec/integration/msgr/dispatcher_spec.rb +28 -12
- data/spec/integration/msgr/railtie_spec.rb +10 -120
- data/spec/integration/spec_helper.rb +2 -3
- data/spec/integration/{msgr_spec.rb → test_controller_spec.rb} +1 -1
- data/spec/unit/msgr/client_spec.rb +88 -0
- data/spec/{msgr → unit}/msgr/connection_spec.rb +1 -1
- data/spec/{msgr → unit}/msgr/consumer_spec.rb +0 -0
- data/spec/unit/msgr/dispatcher_spec.rb +45 -0
- data/spec/{msgr → unit}/msgr/route_spec.rb +15 -14
- data/spec/{msgr → unit}/msgr/routes_spec.rb +32 -35
- data/spec/{msgr → unit}/msgr_spec.rb +25 -16
- data/spec/{msgr → unit}/spec_helper.rb +1 -1
- data/spec/unit/support/.keep +0 -0
- metadata +39 -36
- data/gemfiles/Gemfile.rails-4-2 +0 -7
- data/gemfiles/Gemfile.rails-5-0 +0 -7
- data/gemfiles/Gemfile.rails-5-1 +0 -7
- data/gemfiles/Gemfile.rails-5-2 +0 -7
- data/gemfiles/Gemfile.rails-master +0 -14
- data/spec/msgr/msgr/client_spec.rb +0 -60
- data/spec/msgr/msgr/dispatcher_spec.rb +0 -44
- data/spec/support/setup.rb +0 -29
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '0280e30254fa68bc13cde2f7bbae229f0e355c74ed14258aa71003e670982470'
|
|
4
|
+
data.tar.gz: c601b9c42f3d0a0a031f30aa7223009e5cfb90b51da28ff6d39d80961fd9d6d7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c4503d32dcaffef4c8259f5b5768144d0841f9437cdce6758d88b02f2465e1ffd1a3a1ad0b03130435f222a14971247c41957156088d14496465b5b44315cb02
|
|
7
|
+
data.tar.gz: f200f775facda3273f45746cbc3c7baa110f0b773ebe9d8c120f6956c2ad061a24c62c47b44660f699e55dd38b5f161595958d8685cbba1edf5d4b8657385804
|
data/.editorconfig
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
name: Build
|
|
2
|
+
on: [push]
|
|
3
|
+
jobs:
|
|
4
|
+
test:
|
|
5
|
+
name: Ruby ${{ matrix.ruby }} / ${{ matrix.gemfile }}
|
|
6
|
+
runs-on: ubuntu-20.04
|
|
7
|
+
|
|
8
|
+
strategy:
|
|
9
|
+
matrix:
|
|
10
|
+
ruby:
|
|
11
|
+
- '2.7'
|
|
12
|
+
- '2.6'
|
|
13
|
+
- '2.5'
|
|
14
|
+
gemfile:
|
|
15
|
+
- rails_5.2.gemfile
|
|
16
|
+
- rails_6.0.gemfile
|
|
17
|
+
- rails_6.1.gemfile
|
|
18
|
+
fail-fast: false
|
|
19
|
+
|
|
20
|
+
services:
|
|
21
|
+
rabbitmq:
|
|
22
|
+
image: rabbitmq:latest
|
|
23
|
+
options: --health-cmd "rabbitmqctl node_health_check" --health-interval 10s --health-timeout 5s --health-retries 5
|
|
24
|
+
ports:
|
|
25
|
+
- 5672:5672
|
|
26
|
+
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@master
|
|
29
|
+
|
|
30
|
+
- name: Setup Ruby
|
|
31
|
+
uses: ruby/setup-ruby@v1
|
|
32
|
+
with:
|
|
33
|
+
ruby-version: ${{ matrix.ruby }}
|
|
34
|
+
bundler-cache: true
|
|
35
|
+
bundler: 1
|
|
36
|
+
env:
|
|
37
|
+
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}
|
|
38
|
+
BUNDLE_WITHOUT: development
|
|
39
|
+
BUNDLE_JOBS: 4
|
|
40
|
+
BUNDLE_RETRY: 3
|
|
41
|
+
|
|
42
|
+
- name: Run unit tests
|
|
43
|
+
env:
|
|
44
|
+
AMQP_SERVER: amqp://localhost:5672
|
|
45
|
+
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}
|
|
46
|
+
run: bundle exec rspec -Ispec/unit --color spec/unit
|
|
47
|
+
|
|
48
|
+
- name: Run integration tests
|
|
49
|
+
env:
|
|
50
|
+
AMQP_SERVER: amqp://localhost:5672
|
|
51
|
+
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}
|
|
52
|
+
run: bundle exec rspec -Ispec/integration --color spec/integration
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: Lint
|
|
2
|
+
on: [push]
|
|
3
|
+
jobs:
|
|
4
|
+
rubocop:
|
|
5
|
+
name: rubocop
|
|
6
|
+
runs-on: ubuntu-20.04
|
|
7
|
+
|
|
8
|
+
steps:
|
|
9
|
+
- uses: actions/checkout@master
|
|
10
|
+
- uses: ruby/setup-ruby@v1
|
|
11
|
+
with:
|
|
12
|
+
ruby-version: 2.6
|
|
13
|
+
bundler-cache: true
|
|
14
|
+
env:
|
|
15
|
+
BUNDLE_WITHOUT: development
|
|
16
|
+
BUNDLE_JOBS: 4
|
|
17
|
+
BUNDLE_RETRY: 3
|
|
18
|
+
|
|
19
|
+
- name: Run rubocop
|
|
20
|
+
run: bundle exec rubocop --parallel --color
|
data/.rubocop.yml
CHANGED
|
@@ -1,52 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
inherit_gem:
|
|
2
|
+
my-rubocop: default.yml
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
AllCops:
|
|
5
|
+
TargetRubyVersion: 2.5
|
|
6
6
|
Exclude:
|
|
7
|
-
-
|
|
7
|
+
- gemfiles/**/*
|
|
8
|
+
- spec/integration/dummy/**/*
|
|
9
|
+
- vendor/**/*
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
Layout/LineLength:
|
|
10
12
|
Exclude:
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Layout/AlignParameters:
|
|
15
|
-
EnforcedStyle: with_fixed_indentation
|
|
16
|
-
|
|
17
|
-
Layout/CaseIndentation:
|
|
18
|
-
EnforcedStyle: end
|
|
19
|
-
SupportedStyles:
|
|
20
|
-
- case
|
|
21
|
-
- end
|
|
22
|
-
IndentOneStep: true
|
|
23
|
-
|
|
24
|
-
Layout/SpaceInsideBlockBraces:
|
|
25
|
-
EnforcedStyle: space
|
|
26
|
-
EnforcedStyleForEmptyBraces: no_space
|
|
27
|
-
SpaceBeforeBlockParameters: false
|
|
28
|
-
|
|
29
|
-
Layout/SpaceInsideHashLiteralBraces:
|
|
30
|
-
EnforcedStyle: no_space
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
Style/BracesAroundHashParameters:
|
|
34
|
-
EnforcedStyle: context_dependent
|
|
35
|
-
|
|
36
|
-
Style/ClassAndModuleChildren:
|
|
37
|
-
Enabled: false
|
|
38
|
-
|
|
39
|
-
Style/Documentation:
|
|
40
|
-
Enabled: false
|
|
41
|
-
|
|
42
|
-
Style/RaiseArgs:
|
|
43
|
-
EnforcedStyle: compact
|
|
44
|
-
|
|
45
|
-
Style/SafeNavigation:
|
|
46
|
-
Enabled: false # not available before 2.3
|
|
47
|
-
|
|
48
|
-
Style/SignalException:
|
|
49
|
-
EnforcedStyle: only_raise
|
|
50
|
-
|
|
51
|
-
Style/TrivialAccessors:
|
|
52
|
-
AllowPredicates: true
|
|
13
|
+
- spec/**/*
|
data/.travis.yml
CHANGED
|
@@ -1,43 +1,29 @@
|
|
|
1
|
-
dist:
|
|
1
|
+
dist: bionic
|
|
2
2
|
language: ruby
|
|
3
|
+
cache: bundler
|
|
3
4
|
rvm:
|
|
4
|
-
- 2.
|
|
5
|
-
- 2.
|
|
6
|
-
- 2.
|
|
7
|
-
- 2.3.8
|
|
5
|
+
- 2.7.0
|
|
6
|
+
- 2.6.5
|
|
7
|
+
- 2.5.7
|
|
8
8
|
gemfile:
|
|
9
|
-
- gemfiles/
|
|
10
|
-
- gemfiles/
|
|
11
|
-
- gemfiles/
|
|
12
|
-
- gemfiles/
|
|
13
|
-
- gemfiles/
|
|
9
|
+
- gemfiles/rails_42.gemfile
|
|
10
|
+
- gemfiles/rails_50.gemfile
|
|
11
|
+
- gemfiles/rails_51.gemfile
|
|
12
|
+
- gemfiles/rails_52.gemfile
|
|
13
|
+
- gemfiles/rails_60.gemfile
|
|
14
|
+
- gemfiles/rails_master.gemfile
|
|
14
15
|
before_install:
|
|
15
|
-
- sudo apt-get install -qy rabbitmq-server
|
|
16
|
-
- echo yes | rvm gemset delete global
|
|
17
|
-
- gem install bundler
|
|
16
|
+
- sudo apt-get install -qy rabbitmq-server
|
|
17
|
+
- echo yes | rvm gemset delete global
|
|
18
|
+
- gem install bundler --version '~> 1.0'
|
|
18
19
|
script:
|
|
19
|
-
- bundle exec rake spec:
|
|
20
|
-
- bundle exec rake spec:integration
|
|
20
|
+
- bundle exec rake spec:unit
|
|
21
|
+
- bundle exec rake spec:integration
|
|
21
22
|
jobs:
|
|
22
23
|
allow_failures:
|
|
23
|
-
- gemfile: gemfiles/
|
|
24
|
+
- gemfile: gemfiles/rails_master.gemfile
|
|
24
25
|
exclude:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- rvm: 2.3.8
|
|
30
|
-
gemfile: gemfiles/Gemfile.rails-master
|
|
31
|
-
include:
|
|
32
|
-
- stage: Beta release
|
|
33
|
-
rvm: 2.6.3
|
|
34
|
-
script: echo "Deploy to rubygems.org..."
|
|
35
|
-
deploy:
|
|
36
|
-
provider: rubygems
|
|
37
|
-
api_key:
|
|
38
|
-
secure: g8icPMdxEmbpBzSRCDmR3uB+1Zhu7tGq3h0cVbGUka2Ni1NiEiQo3LCDzbMp+L7AXH5RhdsG9FTViIAyCy9YENqZ1+jzrQGeADx0KnJZb6F81/SyumeUld0zdkzDbe1aUCJWz2WnEk12aLMPLNPRmDE7wub+od7gJEEv2SsKObo=
|
|
39
|
-
gem: msgr
|
|
40
|
-
on:
|
|
41
|
-
branch: master
|
|
42
|
-
repo: jgraichen/msgr
|
|
43
|
-
|
|
26
|
+
- rvm: 2.7.0
|
|
27
|
+
gemfile: gemfiles/rails_42.gemfile
|
|
28
|
+
- rvm: 2.6.5
|
|
29
|
+
gemfile: gemfiles/rails_42.gemfile
|
data/Appraisals
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# -*- mode: ruby -*-
|
|
3
|
+
|
|
4
|
+
appraise 'rails-5.2' do
|
|
5
|
+
gem 'rails', '~> 5.2.0'
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
appraise 'rails-6.0' do
|
|
9
|
+
gem 'rails', '~> 6.0.0'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
appraise 'rails-6.1' do
|
|
13
|
+
gem 'rails', '~> 6.1.0'
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
appraise 'rails-master' do
|
|
17
|
+
gem 'rails', git: 'https://github.com/rails/rails', require: 'rails'
|
|
18
|
+
end
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
|
+
|
|
8
|
+
## [1.3.1] - 2020-12-16
|
|
9
|
+
### Fixed
|
|
10
|
+
- Delay setting default options for correct relative routing file path
|
|
11
|
+
|
|
12
|
+
## [1.3.0] - 2020-12-16
|
|
13
|
+
### Added
|
|
14
|
+
- Support and testing for Rails 6.1
|
|
15
|
+
- Rake task for purging all known queues (#43)
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- High-risk feature to autostart client in-process has been removed without replacement
|
|
19
|
+
- Parsing config is more relaxed now but directly based on YAML boolean values
|
|
20
|
+
|
|
21
|
+
## [1.2.0] - 2019-06-27
|
|
7
22
|
### Added
|
|
8
23
|
- Test support of Rails 5.2
|
|
9
24
|
|
|
@@ -59,7 +74,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
59
74
|
### Changed
|
|
60
75
|
- Loose dependency on bunny to allow `~> 1.4` for stone-age old RabbitMQ servers.
|
|
61
76
|
|
|
62
|
-
## [0.11.0
|
|
77
|
+
## [0.11.0-rc3] - 2014-04-11
|
|
63
78
|
### Added
|
|
64
79
|
- Add checkcredentials config option to disable initial connect to rabbitmq
|
|
65
80
|
server to check the credentials
|
|
@@ -67,18 +82,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
67
82
|
### Changed
|
|
68
83
|
- Define pool_class by string to make it useable with rails
|
|
69
84
|
|
|
70
|
-
## [0.11.0
|
|
85
|
+
## [0.11.0-rc2] - 2014-03-29
|
|
71
86
|
### Added
|
|
72
87
|
- Add nack for messages when an error is rescued by dispatcher
|
|
73
88
|
|
|
74
|
-
## [0.11.0
|
|
89
|
+
## [0.11.0-rc1] - 2014-03-29
|
|
75
90
|
### Added
|
|
76
91
|
- Add pool_class config to override pool classes used by dispatcher
|
|
77
92
|
|
|
78
|
-
## 0.4 - 0.10
|
|
79
|
-
### Changed
|
|
80
|
-
- Some lost history due to several crises
|
|
81
|
-
|
|
82
93
|
## [0.4.1] - 2014-03-18
|
|
83
94
|
### Fixed
|
|
84
95
|
- Fix bug with empty routes on client start
|
|
@@ -87,6 +98,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
87
98
|
### Changed
|
|
88
99
|
- Improve railtie and autostart code
|
|
89
100
|
|
|
101
|
+
## 0.4.0 - 0.10.0
|
|
102
|
+
### Changed
|
|
103
|
+
- Some lost history due to several crises
|
|
104
|
+
|
|
90
105
|
## [0.3.0] - 2014-03-03
|
|
91
106
|
### Added
|
|
92
107
|
- Support for forking web servers like unicorn
|
|
@@ -99,7 +114,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
99
114
|
### Changed
|
|
100
115
|
- Improve rails initializer code
|
|
101
116
|
|
|
102
|
-
[Unreleased]: https://github.com/jgraichen/msgr/compare/v1.1
|
|
117
|
+
[Unreleased]: https://github.com/jgraichen/msgr/compare/v1.3.1...HEAD
|
|
118
|
+
[1.3.1]: https://github.com/jgraichen/msgr/compare/v1.3.0...v1.3.1
|
|
119
|
+
[1.3.0]: https://github.com/jgraichen/msgr/compare/v1.2.0...v1.3.0
|
|
120
|
+
[1.2.0]: https://github.com/jgraichen/msgr/compare/v1.1.0...v1.2.0
|
|
103
121
|
[1.1.0]: https://github.com/jgraichen/msgr/compare/v1.0.0...v1.1.0
|
|
104
122
|
[1.0.0]: https://github.com/jgraichen/msgr/compare/v0.15.2...v1.0.0
|
|
105
123
|
[0.15.2]: https://github.com/jgraichen/msgr/compare/v0.15.1...v0.15.2
|
|
@@ -110,9 +128,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
110
128
|
[0.13.0]: https://github.com/jgraichen/msgr/compare/v0.12.3...v0.13.0
|
|
111
129
|
[0.12.2]: https://github.com/jgraichen/msgr/compare/v0.12.1...v0.12.2
|
|
112
130
|
[0.12.1]: https://github.com/jgraichen/msgr/compare/v0.12.0...v0.12.1
|
|
113
|
-
[0.11.0
|
|
114
|
-
[0.11.0
|
|
115
|
-
[0.11.0
|
|
131
|
+
[0.11.0-rc3]: https://github.com/jgraichen/msgr/compare/v0.11.0.rc2...v0.11.0.rc3
|
|
132
|
+
[0.11.0-rc2]: https://github.com/jgraichen/msgr/compare/v0.11.0.rc1...v0.11.0.rc2
|
|
133
|
+
[0.11.0-rc1]: https://github.com/jgraichen/msgr/compare/v0.10.2...v0.11.0.rc1
|
|
116
134
|
[0.4.1]: https://github.com/jgraichen/msgr/compare/v0.4.0...v0.4.1
|
|
117
135
|
[0.4.0]: https://github.com/jgraichen/msgr/compare/v0.3.0...v0.4.0
|
|
118
136
|
[0.3.0]: https://github.com/jgraichen/msgr/compare/v0.2.1...v0.3.0
|
data/Gemfile
CHANGED
|
@@ -2,22 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
source 'https://rubygems.org'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
gem 'appraisal'
|
|
6
|
+
gem 'coveralls'
|
|
7
|
+
gem 'my-rubocop', github: 'jgraichen/my-rubocop'
|
|
8
|
+
gem 'rake'
|
|
9
|
+
gem 'rake-release', '~> 1.1'
|
|
10
|
+
gem 'rspec', '~> 3.0'
|
|
11
|
+
gem 'rspec-rails'
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
gem 'rails', '>= 4.2'
|
|
16
|
-
gem 'sqlite3', '~> 1.3.6'
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
gem 'rspec-rails', require: false
|
|
20
|
-
end
|
|
13
|
+
gem 'rails'
|
|
14
|
+
gem 'sqlite3'
|
|
21
15
|
|
|
22
16
|
# Specify your gem's dependencies in acfs.gemspec
|
|
23
17
|
gemspec
|
data/README.md
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
[](http://badge.fury.io/rb/msgr)
|
|
5
|
-
[](https://codeclimate.com/github/jgraichen/msgr)
|
|
5
|
+
[](https://travis-ci.org/jgraichen/msgr)
|
|
6
|
+
[](https://github.com/jgraichen/msgr/actions?query=workflow%3ABuild+branch%3Amaster)
|
|
8
7
|
[](http://rubydoc.info/github/jgraichen/msgr/master/frames)
|
|
9
8
|
|
|
10
9
|
You know it and you like it. Using Rails you can just declare your routes and
|
|
@@ -82,16 +81,19 @@ class TestController < ApplicationController
|
|
|
82
81
|
end
|
|
83
82
|
```
|
|
84
83
|
|
|
84
|
+
Run client daemon with `bundle exec msgr`.
|
|
85
|
+
|
|
86
|
+
|
|
85
87
|
## Advanced configuration
|
|
86
88
|
|
|
87
|
-
### Manual message
|
|
89
|
+
### Manual message acknowledgments
|
|
88
90
|
|
|
89
|
-
Per default messages are automatically acknowledged, if no (n)ack is sent explicitly by the consumer. This can be disabled by setting the `auto_ack` attribute to `false`.
|
|
91
|
+
Per default messages are automatically acknowledged, if no (n)ack is sent explicitly by the consumer. This can be disabled by setting the `auto_ack` attribute to `false`.
|
|
90
92
|
|
|
91
93
|
```ruby
|
|
92
94
|
class TestConsumer < Msgr::Consumer
|
|
93
95
|
self.auto_ack = false
|
|
94
|
-
|
|
96
|
+
|
|
95
97
|
def index
|
|
96
98
|
data = { fuubar: 'abc' }
|
|
97
99
|
|
|
@@ -100,7 +102,6 @@ class TestConsumer < Msgr::Consumer
|
|
|
100
102
|
end
|
|
101
103
|
```
|
|
102
104
|
|
|
103
|
-
|
|
104
105
|
### Prefetch count
|
|
105
106
|
|
|
106
107
|
Per default each message queue has a prefetch count of 1. This value can be changed when specifying the messaging routes:
|
|
@@ -109,19 +110,6 @@ Per default each message queue has a prefetch count of 1. This value can be chan
|
|
|
109
110
|
route 'local.test.index', to: 'test#index', prefetch: 42
|
|
110
111
|
```
|
|
111
112
|
|
|
112
|
-
### Msgr and fork web server like unicorn
|
|
113
|
-
|
|
114
|
-
Per default msgr opens the rabbitmq connect when rails is loaded. If you use a multi-process web server that preloads the application (like unicorn) will lead to unexpected behavior. In this case adjust `config/rabbitmq.yml` and adjust `autostart = false`:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
```yaml
|
|
118
|
-
common: &common
|
|
119
|
-
uri: amqp://localhost/
|
|
120
|
-
autostart: false
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
And call inside each worker `Msgr.start` - e.g. in an after-fork block
|
|
124
|
-
|
|
125
113
|
|
|
126
114
|
## Testing
|
|
127
115
|
|
data/Rakefile
CHANGED
|
@@ -7,26 +7,30 @@ rescue LoadError
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
require 'rake'
|
|
10
|
-
require '
|
|
10
|
+
require 'rake/release/task'
|
|
11
11
|
require 'rspec/core/rake_task'
|
|
12
12
|
|
|
13
|
+
Rake::Release::Task.new do |spec|
|
|
14
|
+
spec.sign_tag = true
|
|
15
|
+
end
|
|
16
|
+
|
|
13
17
|
# Delegate spec task task to spec:all to run all specs.
|
|
14
18
|
task spec: 'spec:all'
|
|
15
19
|
|
|
16
20
|
desc 'Run all specs'
|
|
17
21
|
namespace :spec do
|
|
18
22
|
desc 'Run all msgr specs and all integration specs.'
|
|
19
|
-
task all: %i[
|
|
23
|
+
task all: %i[unit integration]
|
|
20
24
|
|
|
21
25
|
desc 'Run all unit specs.'
|
|
22
|
-
RSpec::Core::RakeTask.new(:
|
|
23
|
-
t.ruby_opts = '-Ispec/
|
|
24
|
-
t.pattern = 'spec/
|
|
26
|
+
RSpec::Core::RakeTask.new(:unit) do |t|
|
|
27
|
+
t.ruby_opts = '-Ispec/unit'
|
|
28
|
+
t.pattern = 'spec/unit/**/*_spec.rb'
|
|
25
29
|
end
|
|
26
30
|
|
|
27
31
|
desc 'Run all integration specs.'
|
|
28
32
|
RSpec::Core::RakeTask.new(:integration) do |t|
|
|
29
|
-
t.ruby_opts = '-Ispec/
|
|
33
|
+
t.ruby_opts = '-Ispec/integration'
|
|
30
34
|
t.pattern = 'spec/integration/**/*_spec.rb'
|
|
31
35
|
end
|
|
32
36
|
end
|