msgr 0.11.1 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/msgr/dispatcher.rb +12 -5
- data/lib/msgr/version.rb +2 -2
- data/msgr.gemspec +0 -1
- data/spec/integration/msgr/dispatcher_spec.rb +1 -1
- metadata +1 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af948cc7f2078a819fbe2994d84804502fb368c7
|
4
|
+
data.tar.gz: 44f61987e47d2a2bbae22cd21db176c15213f5cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 588b61937371c0c0a28715c4a5883d94f54929f8e0c71d00883b3d575fac135bcd1280026586d88c9db1febfb000038d2d15bb6e82cb386783ff2dcf4a3ca4d4
|
7
|
+
data.tar.gz: dcb6e855d9f99ad771fed5ecf0b745c9e3eb7f6247fcb84d4f33a5ea6dd228a4de9f822d3fc98c0279598fceca7108a9c8eea75da8edb74662a230a5d1a4c53d
|
data/lib/msgr/dispatcher.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'concurrent'
|
2
|
-
|
3
1
|
module Msgr
|
4
2
|
|
5
3
|
# The Dispatcher receives incoming messages,
|
@@ -12,10 +10,10 @@ module Msgr
|
|
12
10
|
attr_reader :pool
|
13
11
|
|
14
12
|
def initialize(config)
|
15
|
-
config[:pool_class] ||= '
|
16
|
-
log(:info) { "Initialize new dispatcher (#{config[:pool_class]}
|
13
|
+
config[:pool_class] ||= 'Msgr::Dispatcher::NullPool'
|
14
|
+
log(:info) { "Initialize new dispatcher (#{config[:pool_class]}: #{config})..." }
|
17
15
|
|
18
|
-
@pool = config[:pool_class].constantize.new
|
16
|
+
@pool = config[:pool_class].constantize.new config
|
19
17
|
end
|
20
18
|
|
21
19
|
def call(message)
|
@@ -53,5 +51,14 @@ module Msgr
|
|
53
51
|
def to_s
|
54
52
|
self.class.name
|
55
53
|
end
|
54
|
+
|
55
|
+
class NullPool
|
56
|
+
def initialize(*)
|
57
|
+
end
|
58
|
+
|
59
|
+
def post(*args)
|
60
|
+
yield(*args)
|
61
|
+
end
|
62
|
+
end
|
56
63
|
end
|
57
64
|
end
|
data/lib/msgr/version.rb
CHANGED
data/msgr.gemspec
CHANGED
@@ -20,7 +20,6 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_dependency 'activesupport'
|
22
22
|
spec.add_dependency 'bunny', '~> 1.5'
|
23
|
-
spec.add_dependency 'concurrent-ruby', '~> 0.7.0'
|
24
23
|
spec.add_dependency 'multi_json'
|
25
24
|
|
26
25
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
@@ -35,7 +35,7 @@ describe Msgr::Dispatcher do
|
|
35
35
|
let(:action) { -> { dispatcher.call message }}
|
36
36
|
|
37
37
|
before do
|
38
|
-
expect_any_instance_of(::
|
38
|
+
expect_any_instance_of(::Msgr::Dispatcher::NullPool).to receive(:post).and_return { |m, &block| block.call m}
|
39
39
|
expect_any_instance_of(DispatcherTestConsumer).to receive(:index)
|
40
40
|
end
|
41
41
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: msgr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Graichen
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.5'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: concurrent-ruby
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 0.7.0
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 0.7.0
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: multi_json
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|