bunny 0.9.1 → 0.9.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 +4 -4
- data/ChangeLog.md +18 -0
- data/lib/bunny/session.rb +5 -3
- data/lib/bunny/transport.rb +2 -0
- data/lib/bunny/version.rb +1 -1
- data/spec/higher_level_api/integration/basic_cancel_spec.rb +2 -2
- data/spec/higher_level_api/integration/connection_spec.rb +74 -81
- data/spec/higher_level_api/integration/publisher_confirms_spec.rb +5 -4
- metadata +3 -5
- data/spec/unit/transport_spec.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: deafec372105c91a09a6d8b591586e30e4249130
|
4
|
+
data.tar.gz: a1cd14563b4cae9f215b0e0281ef593e671c874c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c6aeff5a3446e1e183ea85eb665d710a583c69c9f0c63bb6eb0fd88799efc996d106cf594bd7daec645bc81c29f2f2fe7ac7c5788399d8191969813d2a52595
|
7
|
+
data.tar.gz: d951ff5afc82912a0aecf6076d8268c1ff14ec7e9a6ecc08cb0d40e5726edffcc7326a7fe73cc56c12b6169dedb9184cd0c2345d5ce823cd7879cb6cfa90488a
|
data/ChangeLog.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
## Changes between Bunny 0.9.1 and 0.9.2
|
2
|
+
|
3
|
+
### Reliability Improvement in Automatic Network Failure Recovery
|
4
|
+
|
5
|
+
Bunny now ensures a new connection transport (socket) is initialized
|
6
|
+
before any recovery is attempted.
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
## Changes between Bunny 0.9.0 and 0.9.1
|
11
|
+
|
12
|
+
### Reliability Improvement in Bunny::Session#create_channel
|
13
|
+
|
14
|
+
`Bunny::Session#create_channel` now uses two separate mutexes to avoid
|
15
|
+
a (very rare) issue when the previous implementation would try to
|
16
|
+
re-acquire the same mutex and fail (Ruby mutexes are non-reentrant).
|
17
|
+
|
18
|
+
|
1
19
|
## Changes between Bunny 0.9.0.rc1 and 0.9.0.rc2
|
2
20
|
|
3
21
|
### Channel Now Properly Restarts Consumer Pool
|
data/lib/bunny/session.rb
CHANGED
@@ -151,8 +151,9 @@ module Bunny
|
|
151
151
|
@transport_mutex = Mutex.new
|
152
152
|
@channels = Hash.new
|
153
153
|
|
154
|
-
|
154
|
+
@origin_thread = Thread.current
|
155
155
|
|
156
|
+
self.reset_continuations
|
156
157
|
self.initialize_transport
|
157
158
|
end
|
158
159
|
|
@@ -485,7 +486,8 @@ module Bunny
|
|
485
486
|
begin
|
486
487
|
sleep @network_recovery_interval
|
487
488
|
@logger.debug "About to start connection recovery..."
|
488
|
-
|
489
|
+
self.initialize_transport
|
490
|
+
self.start
|
489
491
|
|
490
492
|
if open?
|
491
493
|
@recovering_from_network_failure = false
|
@@ -796,7 +798,7 @@ module Bunny
|
|
796
798
|
|
797
799
|
# @private
|
798
800
|
def initialize_transport
|
799
|
-
@transport = Transport.new(self, @host, @port, @opts.merge(:session_thread =>
|
801
|
+
@transport = Transport.new(self, @host, @port, @opts.merge(:session_thread => @origin_thread))
|
800
802
|
end
|
801
803
|
|
802
804
|
# @private
|
data/lib/bunny/transport.rb
CHANGED
@@ -33,6 +33,7 @@ module Bunny
|
|
33
33
|
@port = port
|
34
34
|
@opts = opts
|
35
35
|
|
36
|
+
@logger = session.logger
|
36
37
|
@tls_enabled = tls_enabled?(opts)
|
37
38
|
@tls_certificate_path = tls_certificate_path_from(opts)
|
38
39
|
@tls_key_path = tls_key_path_from(opts)
|
@@ -115,6 +116,7 @@ module Bunny
|
|
115
116
|
end
|
116
117
|
end
|
117
118
|
rescue SystemCallError, Bunny::ClientTimeout, Bunny::ConnectionError, IOError => e
|
119
|
+
@logger.error "Got an exception when sending data: #{e.message} (#{e.class.name})"
|
118
120
|
close
|
119
121
|
@status = :not_connected
|
120
122
|
|
data/lib/bunny/version.rb
CHANGED
@@ -61,10 +61,10 @@ describe Bunny::Consumer, "#cancel" do
|
|
61
61
|
q.subscribe_with(consumer, :block => false)
|
62
62
|
end
|
63
63
|
t.abort_on_exception = true
|
64
|
-
sleep 0
|
64
|
+
sleep 1.0
|
65
65
|
|
66
66
|
consumer.cancel
|
67
|
-
sleep 0
|
67
|
+
sleep 1.0
|
68
68
|
|
69
69
|
ch = connection.create_channel
|
70
70
|
ch.default_exchange.publish("", :routing_key => queue_name)
|
@@ -54,115 +54,108 @@ describe Bunny::Session do
|
|
54
54
|
|
55
55
|
|
56
56
|
context "initialized with all defaults" do
|
57
|
-
after :each do
|
58
|
-
subject.close if subject.open?
|
59
|
-
end
|
60
|
-
|
61
|
-
subject do
|
62
|
-
Bunny.new
|
63
|
-
end
|
64
|
-
|
65
57
|
it "provides a way to fine tune socket options" do
|
66
|
-
|
67
|
-
|
58
|
+
conn = Bunny.new
|
59
|
+
conn.start
|
60
|
+
conn.transport.socket.should respond_to(:setsockopt)
|
61
|
+
|
62
|
+
conn.close
|
68
63
|
end
|
69
64
|
|
70
65
|
it "successfully negotiates the connection" do
|
71
|
-
|
72
|
-
|
66
|
+
conn = Bunny.new
|
67
|
+
conn.start
|
68
|
+
conn.should be_connected
|
73
69
|
|
74
|
-
|
75
|
-
|
70
|
+
conn.server_properties.should_not be_nil
|
71
|
+
conn.server_capabilities.should_not be_nil
|
76
72
|
|
77
|
-
props =
|
73
|
+
props = conn.server_properties
|
78
74
|
|
79
75
|
props["product"].should_not be_nil
|
80
76
|
props["platform"].should_not be_nil
|
81
77
|
props["version"].should_not be_nil
|
82
|
-
end
|
83
|
-
end
|
84
78
|
|
85
|
-
|
86
|
-
after :each do
|
87
|
-
subject.close if subject.open?
|
79
|
+
conn.close
|
88
80
|
end
|
81
|
+
end
|
89
82
|
|
90
|
-
|
91
|
-
|
92
|
-
|
83
|
+
unless ENV["CI"]
|
84
|
+
context "initialized with TCP connection timeout = 5" do
|
85
|
+
it "successfully connects" do
|
86
|
+
conn = described_class.new(:connection_timeout => 5)
|
87
|
+
conn.start
|
88
|
+
conn.should be_connected
|
93
89
|
|
94
|
-
|
95
|
-
|
96
|
-
subject.should be_connected
|
90
|
+
conn.server_properties.should_not be_nil
|
91
|
+
conn.server_capabilities.should_not be_nil
|
97
92
|
|
98
|
-
|
99
|
-
subject.server_capabilities.should_not be_nil
|
93
|
+
props = conn.server_properties
|
100
94
|
|
101
|
-
|
95
|
+
props["product"].should_not be_nil
|
96
|
+
props["platform"].should_not be_nil
|
97
|
+
props["version"].should_not be_nil
|
102
98
|
|
103
|
-
|
104
|
-
|
105
|
-
props["version"].should_not be_nil
|
99
|
+
conn.close
|
100
|
+
end
|
106
101
|
end
|
107
|
-
end
|
108
102
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
103
|
+
context "initialized with :host => 127.0.0.1" do
|
104
|
+
after :each do
|
105
|
+
subject.close if subject.open?
|
106
|
+
end
|
113
107
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
108
|
+
let(:host) { "127.0.0.1" }
|
109
|
+
subject do
|
110
|
+
described_class.new(:host => host)
|
111
|
+
end
|
118
112
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
113
|
+
it "uses hostname = 127.0.0.1" do
|
114
|
+
subject.host.should == host
|
115
|
+
subject.hostname.should == host
|
116
|
+
end
|
123
117
|
|
124
|
-
|
125
|
-
|
126
|
-
|
118
|
+
it "uses port 5672" do
|
119
|
+
subject.port.should == port
|
120
|
+
end
|
127
121
|
|
128
|
-
|
129
|
-
|
122
|
+
it "uses username = guest" do
|
123
|
+
subject.username.should == username
|
124
|
+
end
|
130
125
|
end
|
131
|
-
end
|
132
126
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
127
|
+
context "initialized with :hostname => localhost" do
|
128
|
+
after :each do
|
129
|
+
subject.close if subject.open?
|
130
|
+
end
|
137
131
|
|
138
|
-
|
139
|
-
|
132
|
+
let(:host) { "localhost" }
|
133
|
+
let(:subject) { described_class.new(:hostname => host) }
|
140
134
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
135
|
+
it "uses hostname = localhost" do
|
136
|
+
subject.host.should == host
|
137
|
+
subject.hostname.should == host
|
138
|
+
end
|
145
139
|
|
146
|
-
|
147
|
-
|
148
|
-
|
140
|
+
it "uses port 5672" do
|
141
|
+
subject.port.should == port
|
142
|
+
end
|
149
143
|
|
150
|
-
|
151
|
-
|
152
|
-
|
144
|
+
it "uses username = guest" do
|
145
|
+
subject.username.should == username
|
146
|
+
subject.user.should == username
|
147
|
+
end
|
153
148
|
end
|
154
|
-
end
|
155
149
|
|
156
|
-
unless ENV["CI"]
|
157
150
|
context "initialized with :ssl => true" do
|
158
151
|
let(:subject) do
|
159
152
|
described_class.new(:user => "bunny_gem",
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
153
|
+
:password => "bunny_password",
|
154
|
+
:vhost => "bunny_testbed",
|
155
|
+
:ssl => true,
|
156
|
+
:ssl_cert => "spec/tls/client_cert.pem",
|
157
|
+
:ssl_key => "spec/tls/client_key.pem",
|
158
|
+
:ssl_ca_certificates => ["./spec/tls/cacert.pem"])
|
166
159
|
end
|
167
160
|
|
168
161
|
it "uses TLS port" do
|
@@ -173,12 +166,12 @@ describe Bunny::Session do
|
|
173
166
|
context "initialized with :tls => true" do
|
174
167
|
let(:subject) do
|
175
168
|
described_class.new(:user => "bunny_gem",
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
169
|
+
:password => "bunny_password",
|
170
|
+
:vhost => "bunny_testbed",
|
171
|
+
:tls => true,
|
172
|
+
:tls_cert => "spec/tls/client_cert.pem",
|
173
|
+
:tls_key => "spec/tls/client_key.pem",
|
174
|
+
:tls_ca_certificates => ["./spec/tls/cacert.pem"])
|
182
175
|
end
|
183
176
|
|
184
177
|
it "uses TLS port" do
|
@@ -7,10 +7,11 @@ describe Bunny::Channel do
|
|
7
7
|
c
|
8
8
|
end
|
9
9
|
|
10
|
-
after :
|
10
|
+
after :each do
|
11
11
|
connection.close if connection.open?
|
12
12
|
end
|
13
13
|
|
14
|
+
let(:n) { 200 }
|
14
15
|
|
15
16
|
context "when publishing with confirms enabled" do
|
16
17
|
it "increments delivery index" do
|
@@ -23,15 +24,15 @@ describe Bunny::Channel do
|
|
23
24
|
q = ch.queue("", :exclusive => true)
|
24
25
|
x = ch.default_exchange
|
25
26
|
|
26
|
-
|
27
|
+
n.times do
|
27
28
|
x.publish("xyzzy", :routing_key => q.name)
|
28
29
|
end
|
29
30
|
|
30
|
-
ch.next_publish_seq_no.should ==
|
31
|
+
ch.next_publish_seq_no.should == n + 1
|
31
32
|
ch.wait_for_confirms.should be_true
|
32
33
|
sleep 0.25
|
33
34
|
|
34
|
-
q.message_count.should ==
|
35
|
+
q.message_count.should == n
|
35
36
|
q.purge
|
36
37
|
|
37
38
|
ch.close
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bunny
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Duncan
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2013-07-
|
15
|
+
date: 2013-07-20 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: amq-protocol
|
@@ -181,7 +181,6 @@ files:
|
|
181
181
|
- spec/unit/bunny_spec.rb
|
182
182
|
- spec/unit/concurrent/condition_spec.rb
|
183
183
|
- spec/unit/concurrent/linked_continuation_queue_spec.rb
|
184
|
-
- spec/unit/transport_spec.rb
|
185
184
|
homepage: http://rubybunny.info
|
186
185
|
licenses:
|
187
186
|
- MIT
|
@@ -202,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
202
201
|
version: '0'
|
203
202
|
requirements: []
|
204
203
|
rubyforge_project:
|
205
|
-
rubygems_version: 2.0.
|
204
|
+
rubygems_version: 2.0.5
|
206
205
|
signing_key:
|
207
206
|
specification_version: 4
|
208
207
|
summary: Popular easy to use Ruby client for RabbitMQ
|
@@ -268,5 +267,4 @@ test_files:
|
|
268
267
|
- spec/unit/bunny_spec.rb
|
269
268
|
- spec/unit/concurrent/condition_spec.rb
|
270
269
|
- spec/unit/concurrent/linked_continuation_queue_spec.rb
|
271
|
-
- spec/unit/transport_spec.rb
|
272
270
|
has_rdoc: true
|
data/spec/unit/transport_spec.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
# mystically fails on Rubinius on CI. MK.
|
4
|
-
if RUBY_ENGINE != "rbx"
|
5
|
-
describe Bunny::Transport, ".reachable?" do
|
6
|
-
it "returns true for google.com, 80" do
|
7
|
-
Bunny::Transport.reacheable?("google.com", 80, 1).should be_true
|
8
|
-
end
|
9
|
-
|
10
|
-
it "returns true for google.com, 8088" do
|
11
|
-
Bunny::Transport.reacheable?("google.com", 8088, 1).should be_false
|
12
|
-
end
|
13
|
-
|
14
|
-
it "returns false for google1237982792837.com, 8277" do
|
15
|
-
Bunny::Transport.reacheable?("google1237982792837.com", 8277, 1).should be_false
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|