stapfen 1.3.0 → 1.4.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.
- data/lib/stapfen/version.rb +1 -1
- data/lib/stapfen/worker.rb +3 -3
- data/spec/worker_spec.rb +8 -8
- metadata +4 -4
data/lib/stapfen/version.rb
CHANGED
data/lib/stapfen/worker.rb
CHANGED
@@ -25,11 +25,11 @@ module Stapfen
|
|
25
25
|
# Expects a block to be passed which will yield the appropriate
|
26
26
|
# configuration for the Stomp gem. Whatever the block yields will be passed
|
27
27
|
# directly into the {{Stomp::Client#new}} method
|
28
|
-
def self.configure
|
28
|
+
def self.configure(&block)
|
29
29
|
unless block_given?
|
30
30
|
raise Stapfen::ConfigurationError
|
31
31
|
end
|
32
|
-
@configuration =
|
32
|
+
@configuration = block
|
33
33
|
end
|
34
34
|
|
35
35
|
# Optional method, should be passed a block which will yield a {{Logger}}
|
@@ -81,7 +81,7 @@ module Stapfen
|
|
81
81
|
attr_accessor :client
|
82
82
|
|
83
83
|
def run
|
84
|
-
@client = Stomp::Client.new(self.class.configuration)
|
84
|
+
@client = Stomp::Client.new(self.class.configuration.call)
|
85
85
|
debug("Running with #{@client} inside of Thread:#{Thread.current.object_id}")
|
86
86
|
|
87
87
|
self.class.consumers.each do |name, headers, block|
|
data/spec/worker_spec.rb
CHANGED
@@ -27,7 +27,7 @@ describe Stapfen::Worker do
|
|
27
27
|
config
|
28
28
|
end
|
29
29
|
|
30
|
-
worker.configuration.should == config
|
30
|
+
worker.configuration.call.should == config
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -64,12 +64,12 @@ describe Stapfen::Worker do
|
|
64
64
|
block.call('msg')
|
65
65
|
end
|
66
66
|
end
|
67
|
-
|
67
|
+
|
68
68
|
context 'with just a queue name' do
|
69
69
|
context 'on a failed message' do
|
70
70
|
it 'should not unreceive' do
|
71
71
|
client.should_receive(:unreceive).never
|
72
|
-
|
72
|
+
|
73
73
|
worker.consume(name) {|msg| false }
|
74
74
|
worker.new.run
|
75
75
|
end
|
@@ -77,13 +77,13 @@ describe Stapfen::Worker do
|
|
77
77
|
context 'on a successful message' do
|
78
78
|
it 'should not unreceive' do
|
79
79
|
client.should_receive(:unreceive).never
|
80
|
-
|
80
|
+
|
81
81
|
worker.consume(name) {|msg| true }
|
82
82
|
worker.new.run
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
86
|
-
|
86
|
+
|
87
87
|
context 'with a queue name and headers for a dead_letter_queue and max_redeliveries' do
|
88
88
|
let(:unrec_headers) do
|
89
89
|
{ :dead_letter_queue => '/queue/foo',
|
@@ -93,13 +93,13 @@ describe Stapfen::Worker do
|
|
93
93
|
context 'on a failed message' do
|
94
94
|
it 'should unreceive' do
|
95
95
|
client.should_receive(:unreceive).once
|
96
|
-
|
96
|
+
|
97
97
|
worker.consume(name, raw_headers) {|msg| false }
|
98
98
|
worker.new.run
|
99
99
|
end
|
100
100
|
it 'should pass :unreceive_headers through to the unreceive call' do
|
101
101
|
client.should_receive(:unreceive).with('msg', unrec_headers).once
|
102
|
-
|
102
|
+
|
103
103
|
worker.consume(name, raw_headers) {|msg| false }
|
104
104
|
worker.new.run
|
105
105
|
end
|
@@ -107,7 +107,7 @@ describe Stapfen::Worker do
|
|
107
107
|
context 'on a successfully handled message' do
|
108
108
|
it 'should not unreceive' do
|
109
109
|
client.should_receive(:unreceive).never
|
110
|
-
|
110
|
+
|
111
111
|
worker.consume(name, raw_headers) {|msg| true }
|
112
112
|
worker.new.run
|
113
113
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stapfen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-09-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: stomp
|
@@ -63,7 +63,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
63
63
|
version: '0'
|
64
64
|
segments:
|
65
65
|
- 0
|
66
|
-
hash: -
|
66
|
+
hash: -2279092950717578506
|
67
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
68
|
none: false
|
69
69
|
requirements:
|
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
72
|
version: '0'
|
73
73
|
segments:
|
74
74
|
- 0
|
75
|
-
hash: -
|
75
|
+
hash: -2279092950717578506
|
76
76
|
requirements: []
|
77
77
|
rubyforge_project:
|
78
78
|
rubygems_version: 1.8.25
|