msgr 0.11.0.rc2 → 0.11.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/msgr/dispatcher.rb +3 -3
- data/lib/msgr/railtie.rb +11 -2
- data/lib/msgr/version.rb +1 -1
- data/scripts/simple_test.rb +1 -1
- data/spec/integration/msgr/railtie_spec.rb +22 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0edffc091410f7c6c9a9bf2e1790ec2a2b6054f2
|
4
|
+
data.tar.gz: 23edf10a838aa69bc79dfdc7ba22633eaf46921d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2eee451a47c451ba9e5566d9b5e1ad08bbcf829f3299693cc8e36639aa93dcc89a03a9d5b250ab65fe630f36672e87d4ef78285c1ec05373549d31dde63ce7fe
|
7
|
+
data.tar.gz: 3cbcf7b04c4f164ff1e6fd0631aa1c9e78b50f52e17c91d468b0c5df85ed5e4a2fff970aeec599a7c6269a57d70a60665d146d79d773cfc135aac8058c7d613c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.11.rc3
|
4
|
+
|
5
|
+
* Define pool_class by string to make it useable with rails
|
6
|
+
* Add checkcredentials config option to disable initial connect to rabbitmq
|
7
|
+
server to check the credentials
|
8
|
+
|
3
9
|
## 0.11.rc2
|
4
10
|
|
5
11
|
* Add nack for messages when an error is rescued by dispatcher
|
data/lib/msgr/dispatcher.rb
CHANGED
@@ -12,10 +12,10 @@ module Msgr
|
|
12
12
|
attr_reader :pool
|
13
13
|
|
14
14
|
def initialize(config)
|
15
|
-
|
15
|
+
config[:pool_class] ||= 'Concurrent::CachedThreadPool'
|
16
|
+
log(:info) { "Initialize new dispatcher (#{config[:pool_class]} with #{config[:max]} threads)..." }
|
16
17
|
|
17
|
-
config[:pool_class]
|
18
|
-
@pool = config[:pool_class].new(max: config[:max])
|
18
|
+
@pool = config[:pool_class].constantize.new(max: config[:max])
|
19
19
|
end
|
20
20
|
|
21
21
|
def call(message)
|
data/lib/msgr/railtie.rb
CHANGED
@@ -27,8 +27,8 @@ module Msgr
|
|
27
27
|
return unless cfg # no config given -> does not load Msgr
|
28
28
|
|
29
29
|
Msgr.config = cfg
|
30
|
-
Msgr.client.connect
|
31
|
-
Msgr.start if
|
30
|
+
Msgr.client.connect if cfg[:checkcredentials]
|
31
|
+
Msgr.start if cfg[:autostart]
|
32
32
|
end
|
33
33
|
|
34
34
|
def parse_config(cfg)
|
@@ -56,6 +56,15 @@ module Msgr
|
|
56
56
|
raise ArgumentError, "Invalid value for rabbitmq config autostart: \"#{cfg[:autostart]}\""
|
57
57
|
end
|
58
58
|
|
59
|
+
case cfg[:checkcredentials]
|
60
|
+
when true, 'true', 'enabled', nil
|
61
|
+
cfg[:checkcredentials] = true
|
62
|
+
when false, 'false', 'disabled'
|
63
|
+
cfg[:checkcredentials] = false
|
64
|
+
else
|
65
|
+
raise ArgumentError, "Invalid value for rabbitmq config checkcredentials: \"#{cfg[:checkcredentials]}\""
|
66
|
+
end
|
67
|
+
|
59
68
|
cfg[:routing_file] ||= Rails.root.join('config/msgr.rb').to_s
|
60
69
|
cfg
|
61
70
|
end
|
data/lib/msgr/version.rb
CHANGED
data/scripts/simple_test.rb
CHANGED
@@ -29,6 +29,12 @@ describe Msgr::Railtie do
|
|
29
29
|
|
30
30
|
it { should raise_error 'Invalid value for rabbitmq config autostart: "unvalid"'}
|
31
31
|
end
|
32
|
+
|
33
|
+
context 'with invalid checkcredentials value' do
|
34
|
+
let(:settings) { {"test" => { uri: 'hans', checkcredentials: 'unvalid'}} }
|
35
|
+
|
36
|
+
it { should raise_error 'Invalid value for rabbitmq config checkcredentials: "unvalid"'}
|
37
|
+
end
|
32
38
|
end
|
33
39
|
|
34
40
|
context 'without set routes file' do
|
@@ -78,5 +84,21 @@ describe Msgr::Railtie do
|
|
78
84
|
Msgr::Railtie.load config
|
79
85
|
end
|
80
86
|
end
|
87
|
+
|
88
|
+
context 'without checkcredentials value' do
|
89
|
+
it 'should connect to rabbitmq directly to check credentials' do
|
90
|
+
expect_any_instance_of(Msgr::Client).to receive(:connect)
|
91
|
+
expect(Msgr::Railtie).to receive(:load_config).and_return({ "test" => { uri: 'test' } })
|
92
|
+
Msgr::Railtie.load config
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
context 'with checkcredentials is false' do
|
97
|
+
it 'should connect to rabbitmq directly to check credentials' do
|
98
|
+
expect_any_instance_of(Msgr::Client).to_not receive(:connect)
|
99
|
+
expect(Msgr::Railtie).to receive(:load_config).and_return({ "test" => { uri: 'test', checkcredentials: false } })
|
100
|
+
Msgr::Railtie.load config
|
101
|
+
end
|
102
|
+
end
|
81
103
|
end
|
82
104
|
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: 0.11.0.
|
4
|
+
version: 0.11.0.rc3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Graichen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -189,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
189
|
version: 1.3.1
|
190
190
|
requirements: []
|
191
191
|
rubyforge_project:
|
192
|
-
rubygems_version: 2.2.
|
192
|
+
rubygems_version: 2.2.0
|
193
193
|
signing_key:
|
194
194
|
specification_version: 4
|
195
195
|
summary: 'Msgr: Rails-like Messaging Framework'
|