msgr 0.10.1 → 0.10.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd6e0e247f2d5a00ded45779d38b74c010911ea0
4
- data.tar.gz: b5755aef0ef31022f4c08e0e77452e4f5fb4f317
3
+ metadata.gz: 330e58dd14abbe235da1ee49cf5beebdaa028e5b
4
+ data.tar.gz: d2ca03b11b363e4e79f1287c32b012261e08bc46
5
5
  SHA512:
6
- metadata.gz: aed3f9b878ddb50f34fd39092df43a84499375f5b6df4c01a526ce6ae6dc198b84f5042b9c4dead878bddfce1663793aacd8b26f6a2badc4f696118d6b9895d2
7
- data.tar.gz: d66e60d47cdf1de3cd3708d8d47cc4b287e39a9337549c8891aac1004656baf0fb99f7695c49ee3a210e4e12db821941f01eb74811965a6e0b9a8cf5bdb1d1d7
6
+ metadata.gz: f569c3f10863621e4612f7a6e90ea24a9a033b358f141b5a145424c7ba46c699fa5c641c26482665ca5969cdd4cbdcd7633413dfa91c6b657c8dcb8442e74b3c
7
+ data.tar.gz: 21ca9a133224874ced042ff6d9374ddb53e98e0e0d475ea3db879c26d51653e37143869b45ab5b9bf8124687d49c84f05d55f98fe9300d3f69c1f7d7f7a7bb58
@@ -38,9 +38,9 @@ module Msgr
38
38
  error.backtrace.join("\n")
39
39
  end
40
40
  ensure
41
- if defined?(ActiveRecord) && ActiveRecord::Base.active_connection?
41
+ if defined?(ActiveRecord) && ActiveRecord::Base.connection_pool.active_connection?
42
42
  log(:debug) { 'Release used AR connection for dispatcher thread.' }
43
- ActiveRecord::Base.release_connection
43
+ ActiveRecord::Base.connection_pool.release_connection
44
44
  end
45
45
  end
46
46
 
data/lib/msgr/version.rb CHANGED
@@ -2,7 +2,7 @@ module Msgr
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 10
5
- PATCH = 1
5
+ PATCH = 2
6
6
  STAGE = nil
7
7
  STRING = [MAJOR, MINOR, PATCH, STAGE].reject(&:nil?).join('.')
8
8
 
@@ -0,0 +1,51 @@
1
+ require 'spec_helper'
2
+
3
+ class TestConsumer < Msgr::Consumer
4
+ def index
5
+ puts "<<< #{payload}"
6
+ end
7
+ end
8
+
9
+ describe Msgr::Dispatcher do
10
+ let(:dispatcher) { described_class.new max: 1 }
11
+ let(:consumer) { 'TestConsumer' }
12
+ let(:route) do
13
+ double(:route).tap do |t|
14
+ allow(t).to receive(:consumer).and_return consumer
15
+ allow(t).to receive(:action).and_return 'index'
16
+ end
17
+ end
18
+ let(:connection) do
19
+ double(:connection).tap do |c|
20
+ allow(c).to receive(:ack)
21
+ end
22
+ end
23
+ let(:delivery_info) do
24
+ double(:delivery_info).tap do |ti|
25
+ allow(ti).to receive(:delivery_tag).and_return { 3 }
26
+ end
27
+ end
28
+ let(:payload) { {} }
29
+ let(:metadata) do
30
+ double(:metadata).tap do |metadata|
31
+ allow(metadata).to receive(:content_type).and_return { 'text/plain' }
32
+ end
33
+ end
34
+ let(:message) { Msgr::Message.new connection, delivery_info, metadata, payload, route }
35
+ let(:action) { -> { dispatcher.call message }}
36
+
37
+ before do
38
+ expect_any_instance_of(::Concurrent::CachedThreadPool).to receive(:post).and_return { |m, &block| block.call m}
39
+ expect_any_instance_of(TestConsumer).to receive(:index)
40
+ end
41
+
42
+ it 'should consume message' do
43
+ dispatcher.call message
44
+ end
45
+
46
+ context 'with not acknowlged message' do
47
+ before { dispatcher.call message }
48
+ subject { message }
49
+ it { should be_acked }
50
+ end
51
+ 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.10.1
4
+ version: 0.10.2
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-03-25 00:00:00.000000000 Z
11
+ date: 2014-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -157,6 +157,7 @@ files:
157
157
  - spec/integration/dummy/public/422.html
158
158
  - spec/integration/dummy/public/500.html
159
159
  - spec/integration/dummy/public/favicon.ico
160
+ - spec/integration/msgr/dispatcher_spec.rb
160
161
  - spec/integration/msgr/railtie_spec.rb
161
162
  - spec/integration/msgr_spec.rb
162
163
  - spec/integration/spec_helper.rb
@@ -188,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
189
  version: '0'
189
190
  requirements: []
190
191
  rubyforge_project:
191
- rubygems_version: 2.2.2
192
+ rubygems_version: 2.2.0
192
193
  signing_key:
193
194
  specification_version: 4
194
195
  summary: 'Msgr: Rails-like Messaging Framework'
@@ -238,6 +239,7 @@ test_files:
238
239
  - spec/integration/dummy/public/422.html
239
240
  - spec/integration/dummy/public/500.html
240
241
  - spec/integration/dummy/public/favicon.ico
242
+ - spec/integration/msgr/dispatcher_spec.rb
241
243
  - spec/integration/msgr/railtie_spec.rb
242
244
  - spec/integration/msgr_spec.rb
243
245
  - spec/integration/spec_helper.rb