msgr 1.2.0 → 1.3.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/.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 +11 -1
- data/Gemfile +8 -15
- data/README.md +8 -20
- data/Rakefile +5 -5
- 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 -69
- 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 +1 -1
- 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 +37 -33
- 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
File without changes
|
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.3.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: 2020-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -60,26 +60,29 @@ dependencies:
|
|
60
60
|
version: '0'
|
61
61
|
description: 'Msgr: Rails-like Messaging Framework'
|
62
62
|
email:
|
63
|
-
-
|
63
|
+
- jgraichen@altimos.de
|
64
64
|
executables:
|
65
65
|
- msgr
|
66
66
|
extensions: []
|
67
67
|
extra_rdoc_files: []
|
68
68
|
files:
|
69
|
+
- ".editorconfig"
|
70
|
+
- ".github/workflows/build.yml"
|
71
|
+
- ".github/workflows/lint.yml"
|
69
72
|
- ".gitignore"
|
70
73
|
- ".rubocop.yml"
|
71
74
|
- ".travis.yml"
|
75
|
+
- Appraisals
|
72
76
|
- CHANGELOG.md
|
73
77
|
- Gemfile
|
74
78
|
- LICENSE.txt
|
75
79
|
- README.md
|
76
80
|
- Rakefile
|
77
81
|
- bin/msgr
|
78
|
-
- gemfiles/
|
79
|
-
- gemfiles/
|
80
|
-
- gemfiles/
|
81
|
-
- gemfiles/
|
82
|
-
- gemfiles/Gemfile.rails-master
|
82
|
+
- gemfiles/rails_5.2.gemfile
|
83
|
+
- gemfiles/rails_6.0.gemfile
|
84
|
+
- gemfiles/rails_6.1.gemfile
|
85
|
+
- gemfiles/rails_master.gemfile
|
83
86
|
- lib/msgr.rb
|
84
87
|
- lib/msgr/binding.rb
|
85
88
|
- lib/msgr/channel.rb
|
@@ -94,12 +97,14 @@ files:
|
|
94
97
|
- lib/msgr/railtie.rb
|
95
98
|
- lib/msgr/route.rb
|
96
99
|
- lib/msgr/routes.rb
|
100
|
+
- lib/msgr/tasks/msgr/drain.rake
|
97
101
|
- lib/msgr/test_pool.rb
|
98
102
|
- lib/msgr/version.rb
|
99
103
|
- msgr.gemspec
|
100
104
|
- scripts/simple_test.rb
|
101
|
-
- spec/fixtures/
|
105
|
+
- spec/fixtures/msgr_routes_test_1.rb
|
102
106
|
- spec/integration/dummy/Rakefile
|
107
|
+
- spec/integration/dummy/app/assets/config/manifest.js
|
103
108
|
- spec/integration/dummy/app/consumers/application_consumer.rb
|
104
109
|
- spec/integration/dummy/app/consumers/test_consumer.rb
|
105
110
|
- spec/integration/dummy/app/controllers/application_controller.rb
|
@@ -125,18 +130,17 @@ files:
|
|
125
130
|
- spec/integration/dummy/public/favicon.ico
|
126
131
|
- spec/integration/msgr/dispatcher_spec.rb
|
127
132
|
- spec/integration/msgr/railtie_spec.rb
|
128
|
-
- spec/integration/msgr_spec.rb
|
129
133
|
- spec/integration/spec_helper.rb
|
130
|
-
- spec/
|
131
|
-
- spec/
|
132
|
-
- spec/
|
133
|
-
- spec/
|
134
|
-
- spec/
|
135
|
-
- spec/
|
136
|
-
- spec/msgr/
|
137
|
-
- spec/
|
138
|
-
- spec/
|
139
|
-
- spec/support
|
134
|
+
- spec/integration/test_controller_spec.rb
|
135
|
+
- spec/unit/msgr/client_spec.rb
|
136
|
+
- spec/unit/msgr/connection_spec.rb
|
137
|
+
- spec/unit/msgr/consumer_spec.rb
|
138
|
+
- spec/unit/msgr/dispatcher_spec.rb
|
139
|
+
- spec/unit/msgr/route_spec.rb
|
140
|
+
- spec/unit/msgr/routes_spec.rb
|
141
|
+
- spec/unit/msgr_spec.rb
|
142
|
+
- spec/unit/spec_helper.rb
|
143
|
+
- spec/unit/support/.keep
|
140
144
|
homepage: https://github.com/jgraichen/msgr
|
141
145
|
licenses:
|
142
146
|
- MIT
|
@@ -156,13 +160,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
160
|
- !ruby/object:Gem::Version
|
157
161
|
version: '0'
|
158
162
|
requirements: []
|
159
|
-
rubygems_version: 3.0.
|
163
|
+
rubygems_version: 3.0.8
|
160
164
|
signing_key:
|
161
165
|
specification_version: 4
|
162
166
|
summary: 'Msgr: Rails-like Messaging Framework'
|
163
167
|
test_files:
|
164
|
-
- spec/fixtures/
|
168
|
+
- spec/fixtures/msgr_routes_test_1.rb
|
165
169
|
- spec/integration/dummy/Rakefile
|
170
|
+
- spec/integration/dummy/app/assets/config/manifest.js
|
166
171
|
- spec/integration/dummy/app/consumers/application_consumer.rb
|
167
172
|
- spec/integration/dummy/app/consumers/test_consumer.rb
|
168
173
|
- spec/integration/dummy/app/controllers/application_controller.rb
|
@@ -188,15 +193,14 @@ test_files:
|
|
188
193
|
- spec/integration/dummy/public/favicon.ico
|
189
194
|
- spec/integration/msgr/dispatcher_spec.rb
|
190
195
|
- spec/integration/msgr/railtie_spec.rb
|
191
|
-
- spec/integration/msgr_spec.rb
|
192
196
|
- spec/integration/spec_helper.rb
|
193
|
-
- spec/
|
194
|
-
- spec/
|
195
|
-
- spec/
|
196
|
-
- spec/
|
197
|
-
- spec/
|
198
|
-
- spec/
|
199
|
-
- spec/msgr/
|
200
|
-
- spec/
|
201
|
-
- spec/
|
202
|
-
- spec/support
|
197
|
+
- spec/integration/test_controller_spec.rb
|
198
|
+
- spec/unit/msgr/client_spec.rb
|
199
|
+
- spec/unit/msgr/connection_spec.rb
|
200
|
+
- spec/unit/msgr/consumer_spec.rb
|
201
|
+
- spec/unit/msgr/dispatcher_spec.rb
|
202
|
+
- spec/unit/msgr/route_spec.rb
|
203
|
+
- spec/unit/msgr/routes_spec.rb
|
204
|
+
- spec/unit/msgr_spec.rb
|
205
|
+
- spec/unit/spec_helper.rb
|
206
|
+
- spec/unit/support/.keep
|
data/gemfiles/Gemfile.rails-4-2
DELETED
data/gemfiles/Gemfile.rails-5-0
DELETED
data/gemfiles/Gemfile.rails-5-1
DELETED
data/gemfiles/Gemfile.rails-5-2
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
NO_RAILS_GEM = true
|
4
|
-
|
5
|
-
# Load root Gemfile
|
6
|
-
eval_gemfile '../Gemfile'
|
7
|
-
|
8
|
-
gem 'activesupport', git: 'https://github.com/rails/rails'
|
9
|
-
gem 'bunny', ENV['BUNNY_VERSION'] if ENV['BUNNY_VERSION']
|
10
|
-
|
11
|
-
group :rails do
|
12
|
-
gem 'rails', '>= 5.2', git: 'https://github.com/rails/rails', require: 'rails'
|
13
|
-
gem 'sqlite3', '~> 1.4'
|
14
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Msgr::Client do
|
6
|
-
subject { described_class.new config }
|
7
|
-
let(:config) { {} }
|
8
|
-
|
9
|
-
describe '#uri' do
|
10
|
-
subject { super().uri.to_s }
|
11
|
-
|
12
|
-
context 'with default config' do
|
13
|
-
it 'uses the default config' do
|
14
|
-
is_expected.to eq 'amqp://127.0.0.1'
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
context 'with overwritten URI' do
|
19
|
-
context 'without vhost' do
|
20
|
-
let(:config) { {uri: 'amqp://rabbit'} }
|
21
|
-
|
22
|
-
it 'does not specify a vhost' do
|
23
|
-
is_expected.to eq 'amqp://rabbit'
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
context 'with empty vhost' do
|
28
|
-
let(:config) { {uri: 'amqp://rabbit/'} }
|
29
|
-
|
30
|
-
it 'does not specify a vhost' do
|
31
|
-
is_expected.to eq 'amqp://rabbit'
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
context 'with explicit vhost' do
|
36
|
-
let(:config) { {uri: 'amqp://rabbit/some_vhost'} }
|
37
|
-
|
38
|
-
# This behavior is due to legacy parsing in Msgr's config.
|
39
|
-
# We interpret the entire path (incl. the leading slash)
|
40
|
-
# as vhost. As per AMQP rules, this means the leading slash
|
41
|
-
# is part of the vhost, which means it has to be URL encoded.
|
42
|
-
# This will likely change with the next major release.
|
43
|
-
it 'uses the entire path as vhost' do
|
44
|
-
is_expected.to eq 'amqp://rabbit/%2Fsome_vhost'
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context 'with URI and vhost' do
|
50
|
-
let(:config) { {uri: 'amqp://rabbit/some_vhost', vhost: 'real_vhost'} }
|
51
|
-
|
52
|
-
# This is currently the only way to specify a vhost without
|
53
|
-
# leading slash (as a vhost in the :uri config would have
|
54
|
-
# an extra URL encoded leading slash).
|
55
|
-
it 'uses the explicit vhost' do
|
56
|
-
is_expected.to eq 'amqp://rabbit/real_vhost'
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
class MsgrAutoAckConsumer < Msgr::Consumer
|
6
|
-
self.auto_ack = true
|
7
|
-
|
8
|
-
def index
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
class MsgrManualAckConsumer < Msgr::Consumer
|
13
|
-
self.auto_ack = false
|
14
|
-
|
15
|
-
def index
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe Msgr::Dispatcher do
|
20
|
-
let(:config) { {} }
|
21
|
-
let(:args) { [config] }
|
22
|
-
let(:dispatcher) { Msgr::Dispatcher.new(*args) }
|
23
|
-
subject { dispatcher }
|
24
|
-
|
25
|
-
describe 'dispatch' do
|
26
|
-
it 'should ack messages automatically if auto_ack is enabled' do
|
27
|
-
route_db = double('Route', :consumer => 'MsgrAutoAckConsumer', :action => :index)
|
28
|
-
msg_db = double('Message', :route => route_db, :acked? => false)
|
29
|
-
expect(msg_db).to receive(:ack)
|
30
|
-
expect(msg_db).not_to receive(:nack)
|
31
|
-
|
32
|
-
dispatcher.dispatch(msg_db)
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'should not ack messages if auto_ack is disabled' do
|
36
|
-
route_db = double('Route', :consumer => 'MsgrManualAckConsumer', :action => :index)
|
37
|
-
msg_db = double('Message', :route => route_db, :acked? => false)
|
38
|
-
expect(msg_db).not_to receive(:ack)
|
39
|
-
expect(msg_db).not_to receive(:nack)
|
40
|
-
|
41
|
-
dispatcher.dispatch(msg_db)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
data/spec/support/setup.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'bundler'
|
4
|
-
|
5
|
-
# Somewhere between
|
6
|
-
# `ruby -w -W2 -S rspec ...`
|
7
|
-
# and the rspec executable `bundle/setup` is required or
|
8
|
-
# `Bundler.setup` without groups called. This will let Bundler
|
9
|
-
# load ALL gems from ALL groups. This results in leaking
|
10
|
-
# gems only for rails integration tests into msgr testing
|
11
|
-
# environment.
|
12
|
-
#
|
13
|
-
# This file will be required by ruby on the commandline before
|
14
|
-
# everything else can kick in. The code snippet below will
|
15
|
-
# patch bundler to just ignore `setup` calls without
|
16
|
-
# specified groups. All test helper will explicit call
|
17
|
-
# `Bundler.setup` with required test groups.
|
18
|
-
|
19
|
-
module Bundler
|
20
|
-
class << self
|
21
|
-
alias old_setup setup
|
22
|
-
def setup(*groups)
|
23
|
-
old_setup(*groups) unless groups.empty?
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
# Only load default group
|
29
|
-
Bundler.setup :default
|