bunny 2.6.3 → 2.6.4
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/.travis.yml +7 -3
- data/ChangeLog.md +23 -2
- data/Gemfile +3 -3
- data/LICENSE +1 -1
- data/README.md +2 -2
- data/lib/bunny/channel.rb +1 -1
- data/lib/bunny/channel_id_allocator.rb +3 -3
- data/lib/bunny/concurrent/continuation_queue.rb +9 -5
- data/lib/bunny/exceptions.rb +6 -0
- data/lib/bunny/session.rb +69 -11
- data/lib/bunny/transport.rb +1 -1
- data/lib/bunny/version.rb +1 -1
- data/spec/higher_level_api/integration/basic_ack_spec.rb +46 -46
- data/spec/higher_level_api/integration/basic_cancel_spec.rb +13 -13
- data/spec/higher_level_api/integration/basic_consume_spec.rb +40 -40
- data/spec/higher_level_api/integration/basic_consume_with_objects_spec.rb +5 -5
- data/spec/higher_level_api/integration/basic_get_spec.rb +5 -5
- data/spec/higher_level_api/integration/basic_nack_spec.rb +13 -13
- data/spec/higher_level_api/integration/basic_publish_spec.rb +7 -7
- data/spec/higher_level_api/integration/basic_qos_spec.rb +1 -1
- data/spec/higher_level_api/integration/basic_reject_spec.rb +23 -23
- data/spec/higher_level_api/integration/basic_return_spec.rb +3 -3
- data/spec/higher_level_api/integration/channel_close_spec.rb +1 -1
- data/spec/higher_level_api/integration/channel_open_spec.rb +1 -1
- data/spec/higher_level_api/integration/connection_recovery_spec.rb +93 -55
- data/spec/higher_level_api/integration/connection_spec.rb +46 -46
- data/spec/higher_level_api/integration/connection_stop_spec.rb +9 -8
- data/spec/higher_level_api/integration/consumer_cancellation_notification_spec.rb +14 -14
- data/spec/higher_level_api/integration/dead_lettering_spec.rb +8 -8
- data/spec/higher_level_api/integration/exchange_bind_spec.rb +4 -4
- data/spec/higher_level_api/integration/exchange_declare_spec.rb +10 -10
- data/spec/higher_level_api/integration/exchange_delete_spec.rb +1 -1
- data/spec/higher_level_api/integration/exchange_unbind_spec.rb +3 -3
- data/spec/higher_level_api/integration/exclusive_queue_spec.rb +5 -5
- data/spec/higher_level_api/integration/heartbeat_spec.rb +4 -4
- data/spec/higher_level_api/integration/merry_go_round_spec.rb +10 -10
- data/spec/higher_level_api/integration/message_properties_access_spec.rb +22 -22
- data/spec/higher_level_api/integration/predeclared_exchanges_spec.rb +1 -1
- data/spec/higher_level_api/integration/publisher_confirms_spec.rb +8 -8
- data/spec/higher_level_api/integration/publishing_edge_cases_spec.rb +10 -10
- data/spec/higher_level_api/integration/queue_bind_spec.rb +10 -10
- data/spec/higher_level_api/integration/queue_declare_spec.rb +14 -11
- data/spec/higher_level_api/integration/queue_delete_spec.rb +1 -1
- data/spec/higher_level_api/integration/queue_purge_spec.rb +3 -3
- data/spec/higher_level_api/integration/queue_unbind_spec.rb +4 -4
- data/spec/higher_level_api/integration/read_only_consumer_spec.rb +7 -7
- data/spec/higher_level_api/integration/sender_selected_distribution_spec.rb +6 -6
- data/spec/higher_level_api/integration/tls_connection_spec.rb +40 -40
- data/spec/higher_level_api/integration/tx_commit_spec.rb +1 -1
- data/spec/higher_level_api/integration/tx_rollback_spec.rb +1 -1
- data/spec/higher_level_api/integration/with_channel_spec.rb +1 -1
- data/spec/issues/issue100_spec.rb +7 -7
- data/spec/issues/issue141_spec.rb +3 -3
- data/spec/issues/issue224_spec.rb +3 -3
- data/spec/issues/issue465_spec.rb +32 -0
- data/spec/issues/issue78_spec.rb +11 -10
- data/spec/issues/issue83_spec.rb +1 -1
- data/spec/issues/issue97_spec.rb +20 -20
- data/spec/stress/channel_close_stress_spec.rb +3 -3
- data/spec/stress/channel_open_stress_spec.rb +3 -3
- data/spec/stress/channel_open_stress_with_single_threaded_connection_spec.rb +2 -1
- data/spec/stress/concurrent_consumers_stress_spec.rb +6 -6
- data/spec/stress/concurrent_publishers_stress_spec.rb +2 -1
- data/spec/stress/connection_open_close_spec.rb +3 -3
- data/spec/stress/long_running_consumer_spec.rb +7 -5
- data/spec/unit/concurrent/condition_spec.rb +5 -5
- metadata +4 -6
- data/spec/higher_level_api/integration/basic_recover_spec.rb +0 -18
- data/spec/higher_level_api/integration/consistent_hash_exchange_spec.rb +0 -59
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Bunny::Channel, "#tx_rollback" do
|
4
4
|
let(:connection) do
|
5
|
-
c = Bunny.new(:
|
5
|
+
c = Bunny.new(username: "bunny_gem", password: "bunny_password", vhost: "bunny_testbed")
|
6
6
|
c.start
|
7
7
|
c
|
8
8
|
end
|
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Bunny::Channel, "#with_channel" do
|
4
4
|
let(:connection) do
|
5
|
-
c = Bunny.new(:
|
5
|
+
c = Bunny.new(username: "bunny_gem", password: "bunny_password", vhost: "bunny_testbed")
|
6
6
|
c.start
|
7
7
|
c
|
8
8
|
end
|
@@ -3,11 +3,11 @@ require "spec_helper"
|
|
3
3
|
unless ENV["CI"]
|
4
4
|
describe Bunny::Channel, "#basic_publish" do
|
5
5
|
before :all do
|
6
|
-
@connection = Bunny.new(:
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
6
|
+
@connection = Bunny.new(username: "bunny_gem",
|
7
|
+
password: "bunny_password",
|
8
|
+
vhost: "bunny_testbed",
|
9
|
+
write_timeout: 0,
|
10
|
+
read_timeout: 0)
|
11
11
|
@connection.start
|
12
12
|
end
|
13
13
|
|
@@ -23,13 +23,13 @@ unless ENV["CI"]
|
|
23
23
|
it "successfully publishers them all" do
|
24
24
|
ch = @connection.create_channel
|
25
25
|
|
26
|
-
q = ch.queue("", :
|
26
|
+
q = ch.queue("", exclusive: true)
|
27
27
|
x = ch.default_exchange
|
28
28
|
|
29
29
|
body = "x" * 1024
|
30
30
|
m.times do |i|
|
31
31
|
n.times do
|
32
|
-
x.publish(body, :
|
32
|
+
x.publish(body, routing_key: q.name)
|
33
33
|
end
|
34
34
|
puts "Published #{i * n} 1K messages..."
|
35
35
|
end
|
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe "Registering 2nd exclusive consumer on queue" do
|
4
4
|
before :all do
|
5
|
-
@connection = Bunny.new(:user => "bunny_gem", :
|
5
|
+
@connection = Bunny.new(:user => "bunny_gem", password: "bunny_password", :vhost => "bunny_testbed")
|
6
6
|
@connection.start
|
7
7
|
end
|
8
8
|
|
@@ -19,13 +19,13 @@ describe "Registering 2nd exclusive consumer on queue" do
|
|
19
19
|
q1 = ch1.queue("", :auto_delete => true)
|
20
20
|
q2 = ch2.queue(q1.name, :auto_delete => true, :passive => true)
|
21
21
|
|
22
|
-
c1 = q1.subscribe(:
|
22
|
+
c1 = q1.subscribe(exclusive: true) do |_, _, payload|
|
23
23
|
xs << payload
|
24
24
|
end
|
25
25
|
sleep 0.1
|
26
26
|
|
27
27
|
expect do
|
28
|
-
q2.subscribe(:
|
28
|
+
q2.subscribe(exclusive: true) do |_, _, _|
|
29
29
|
end
|
30
30
|
end.to raise_error(Bunny::AccessRefused)
|
31
31
|
|
@@ -5,7 +5,7 @@ unless ENV["CI"]
|
|
5
5
|
describe "Message framing implementation" do
|
6
6
|
let(:connection) do
|
7
7
|
c = Bunny.new(:user => "bunny_gem",
|
8
|
-
:
|
8
|
+
password: "bunny_password",
|
9
9
|
:vhost => "bunny_testbed",
|
10
10
|
:port => ENV.fetch("RABBITMQ_PORT", 5672))
|
11
11
|
c.start
|
@@ -21,11 +21,11 @@ unless ENV["CI"]
|
|
21
21
|
it "successfully frames the message" do
|
22
22
|
ch = connection.create_channel
|
23
23
|
|
24
|
-
q = ch.queue("", :
|
24
|
+
q = ch.queue("", exclusive: true)
|
25
25
|
x = ch.default_exchange
|
26
26
|
|
27
27
|
as = ("a" * 272179)
|
28
|
-
x.publish(as, :
|
28
|
+
x.publish(as, routing_key: q.name, persistent: true)
|
29
29
|
|
30
30
|
sleep(1)
|
31
31
|
expect(q.message_count).to eq 1
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Bunny::Session do
|
5
|
+
let(:connection) do
|
6
|
+
c = Bunny.new(
|
7
|
+
user: 'bunny_gem', password: 'bunny_password',
|
8
|
+
vhost: 'bunny_testbed',
|
9
|
+
port: ENV.fetch('RABBITMQ_PORT', 5672)
|
10
|
+
)
|
11
|
+
c.start
|
12
|
+
c
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'after the connection has been manually closed' do
|
16
|
+
before :each do
|
17
|
+
connection.close
|
18
|
+
end
|
19
|
+
|
20
|
+
after :each do
|
21
|
+
connection.close if connection.open?
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#create_channel' do
|
25
|
+
it 'should raise an exception' do
|
26
|
+
expect {
|
27
|
+
connection.create_channel
|
28
|
+
}.to raise_error(Bunny::ConnectionAlreadyClosed)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/spec/issues/issue78_spec.rb
CHANGED
@@ -3,15 +3,16 @@ require "spec_helper"
|
|
3
3
|
unless ENV["CI"]
|
4
4
|
describe Bunny::Queue, "#subscribe" do
|
5
5
|
before :all do
|
6
|
-
@connection1 = Bunny.new(:user => "bunny_gem", :
|
6
|
+
@connection1 = Bunny.new(:user => "bunny_gem", password: "bunny_password", :vhost => "bunny_testbed")
|
7
7
|
@connection1.start
|
8
|
-
@connection2 = Bunny.new(:user => "bunny_gem", :
|
8
|
+
@connection2 = Bunny.new(:user => "bunny_gem", password: "bunny_password", :vhost => "bunny_testbed")
|
9
9
|
@connection2.start
|
10
10
|
end
|
11
11
|
|
12
12
|
after :all do
|
13
|
-
@connection1.
|
14
|
-
|
13
|
+
[@connection1, @connection2].select { |c| !!c }.each do |c|
|
14
|
+
c.close if c.open?
|
15
|
+
end
|
15
16
|
end
|
16
17
|
|
17
18
|
|
@@ -22,14 +23,14 @@ unless ENV["CI"]
|
|
22
23
|
ch1 = @connection1.create_channel
|
23
24
|
ch2 = @connection1.create_channel
|
24
25
|
|
25
|
-
q = ch1.queue("", :
|
26
|
-
q.subscribe(:
|
26
|
+
q = ch1.queue("", exclusive: true)
|
27
|
+
q.subscribe(manual_ack: false, block: false) do |delivery_info, properties, payload|
|
27
28
|
delivered_data << payload
|
28
29
|
end
|
29
30
|
sleep 0.5
|
30
31
|
|
31
32
|
x = ch2.default_exchange
|
32
|
-
x.publish("abc", :
|
33
|
+
x.publish("abc", routing_key: q.name)
|
33
34
|
sleep 0.7
|
34
35
|
|
35
36
|
expect(delivered_data).to eq ["abc"]
|
@@ -48,15 +49,15 @@ unless ENV["CI"]
|
|
48
49
|
ch1 = @connection1.create_channel
|
49
50
|
ch2 = @connection1.create_channel
|
50
51
|
|
51
|
-
q = ch1.queue(queue_name, :
|
52
|
+
q = ch1.queue(queue_name, exclusive: true)
|
52
53
|
x = ch2.default_exchange
|
53
54
|
3.times do |i|
|
54
|
-
x.publish("data#{i}", :
|
55
|
+
x.publish("data#{i}", routing_key: queue_name)
|
55
56
|
end
|
56
57
|
sleep 0.7
|
57
58
|
expect(q.message_count).to eq 3
|
58
59
|
|
59
|
-
q.subscribe(:
|
60
|
+
q.subscribe(manual_ack: false, block: false) do |delivery_info, properties, payload|
|
60
61
|
delivered_data << payload
|
61
62
|
end
|
62
63
|
sleep 0.7
|
data/spec/issues/issue83_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Bunny::Channel, "#open" do
|
4
4
|
before :all do
|
5
|
-
@connection = Bunny.new(:user => "bunny_gem", :
|
5
|
+
@connection = Bunny.new(:user => "bunny_gem", password: "bunny_password", :vhost => "bunny_testbed")
|
6
6
|
@connection.start
|
7
7
|
end
|
8
8
|
|
data/spec/issues/issue97_spec.rb
CHANGED
@@ -2,10 +2,10 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe "Message framing implementation" do
|
4
4
|
before :all do
|
5
|
-
@connection = Bunny.new(:
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
@connection = Bunny.new(username: "bunny_gem",
|
6
|
+
password: "bunny_password",
|
7
|
+
vhost: "bunny_testbed",
|
8
|
+
port: ENV.fetch("RABBITMQ_PORT", 5672))
|
9
9
|
@connection.start
|
10
10
|
end
|
11
11
|
|
@@ -19,11 +19,11 @@ describe "Message framing implementation" do
|
|
19
19
|
it "successfully frames the message" do
|
20
20
|
ch = @connection.create_channel
|
21
21
|
|
22
|
-
q = ch.queue("", :
|
22
|
+
q = ch.queue("", exclusive: true)
|
23
23
|
x = ch.default_exchange
|
24
24
|
|
25
25
|
body = IO.read("spec/issues/issue97_attachment.json")
|
26
|
-
x.publish(body, :
|
26
|
+
x.publish(body, routing_key: q.name, persistent: true)
|
27
27
|
|
28
28
|
sleep(1)
|
29
29
|
expect(q.message_count).to eq 1
|
@@ -39,11 +39,11 @@ describe "Message framing implementation" do
|
|
39
39
|
it "successfully frames the message" do
|
40
40
|
ch = @connection.create_channel
|
41
41
|
|
42
|
-
q = ch.queue("", :
|
42
|
+
q = ch.queue("", exclusive: true)
|
43
43
|
x = ch.default_exchange
|
44
44
|
|
45
45
|
as = ("a" * (1024 * 1024 * 4 + 2823777))
|
46
|
-
x.publish(as, :
|
46
|
+
x.publish(as, routing_key: q.name, persistent: true)
|
47
47
|
|
48
48
|
sleep(1)
|
49
49
|
expect(q.message_count).to eq 1
|
@@ -61,10 +61,10 @@ describe "Message framing implementation" do
|
|
61
61
|
it "successfully publishes the message" do
|
62
62
|
ch = @connection.create_channel
|
63
63
|
|
64
|
-
q = ch.queue("", :
|
64
|
+
q = ch.queue("", exclusive: true)
|
65
65
|
x = ch.default_exchange
|
66
66
|
|
67
|
-
x.publish("", :
|
67
|
+
x.publish("", routing_key: q.name, persistent: true)
|
68
68
|
|
69
69
|
sleep(1)
|
70
70
|
expect(q.message_count).to eq 1
|
@@ -86,11 +86,11 @@ describe "Message framing implementation" do
|
|
86
86
|
it "successfully frames the message" do
|
87
87
|
ch = @connection.create_channel
|
88
88
|
|
89
|
-
q = ch.queue("", :
|
89
|
+
q = ch.queue("", exclusive: true)
|
90
90
|
x = ch.default_exchange
|
91
91
|
|
92
92
|
as = "a" * (1024 * 128 - 2)
|
93
|
-
x.publish(as, :
|
93
|
+
x.publish(as, routing_key: q.name, persistent: true)
|
94
94
|
|
95
95
|
sleep(1)
|
96
96
|
expect(q.message_count).to eq 1
|
@@ -104,11 +104,11 @@ describe "Message framing implementation" do
|
|
104
104
|
it "successfully frames the message" do
|
105
105
|
ch = @connection.create_channel
|
106
106
|
|
107
|
-
q = ch.queue("", :
|
107
|
+
q = ch.queue("", exclusive: true)
|
108
108
|
x = ch.default_exchange
|
109
109
|
|
110
110
|
as = "a" * (1024 * 128 - 1)
|
111
|
-
x.publish(as, :
|
111
|
+
x.publish(as, routing_key: q.name, persistent: true)
|
112
112
|
|
113
113
|
sleep(1)
|
114
114
|
expect(q.message_count).to eq 1
|
@@ -122,11 +122,11 @@ describe "Message framing implementation" do
|
|
122
122
|
it "successfully frames the message" do
|
123
123
|
ch = @connection.create_channel
|
124
124
|
|
125
|
-
q = ch.queue("", :
|
125
|
+
q = ch.queue("", exclusive: true)
|
126
126
|
x = ch.default_exchange
|
127
127
|
|
128
128
|
as = "a" * (1024 * 128)
|
129
|
-
x.publish(as, :
|
129
|
+
x.publish(as, routing_key: q.name, persistent: true)
|
130
130
|
|
131
131
|
sleep(1)
|
132
132
|
expect(q.message_count).to eq 1
|
@@ -141,11 +141,11 @@ describe "Message framing implementation" do
|
|
141
141
|
it "successfully frames the message" do
|
142
142
|
ch = @connection.create_channel
|
143
143
|
|
144
|
-
q = ch.queue("", :
|
144
|
+
q = ch.queue("", exclusive: true)
|
145
145
|
x = ch.default_exchange
|
146
146
|
|
147
147
|
as = "a" * (1024 * 128 + 1)
|
148
|
-
x.publish(as, :
|
148
|
+
x.publish(as, routing_key: q.name, persistent: true)
|
149
149
|
|
150
150
|
sleep(1)
|
151
151
|
expect(q.message_count).to eq 1
|
@@ -159,11 +159,11 @@ describe "Message framing implementation" do
|
|
159
159
|
it "successfully frames the message" do
|
160
160
|
ch = @connection.create_channel
|
161
161
|
|
162
|
-
q = ch.queue("", :
|
162
|
+
q = ch.queue("", exclusive: true)
|
163
163
|
x = ch.default_exchange
|
164
164
|
|
165
165
|
as = "a" * (1024 * 128 + 2)
|
166
|
-
x.publish(as, :
|
166
|
+
x.publish(as, routing_key: q.name, persistent: true)
|
167
167
|
|
168
168
|
sleep(1)
|
169
169
|
expect(q.message_count).to eq 1
|
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe "Rapidly closing lots of temporary channels" do
|
4
4
|
before :all do
|
5
|
-
@connection = Bunny.new(:
|
5
|
+
@connection = Bunny.new(automatic_recovery: false).tap do |c|
|
6
6
|
c.start
|
7
7
|
end
|
8
8
|
end
|
@@ -21,7 +21,7 @@ describe "Rapidly closing lots of temporary channels" do
|
|
21
21
|
n.times do
|
22
22
|
t = Thread.new do
|
23
23
|
@connection.with_channel do |ch1|
|
24
|
-
q = ch1.queue("", :
|
24
|
+
q = ch1.queue("", exclusive: true)
|
25
25
|
q.delete
|
26
26
|
ch1.close
|
27
27
|
end
|
@@ -49,7 +49,7 @@ describe "Rapidly closing lots of temporary channels" do
|
|
49
49
|
t = Thread.new do
|
50
50
|
3.times do
|
51
51
|
@connection.with_channel do |ch|
|
52
|
-
x = ch.topic('bunny.stress.topics.t2', :
|
52
|
+
x = ch.topic('bunny.stress.topics.t2', durable: false)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe "Rapidly opening and closing lots of channels" do
|
4
4
|
before :all do
|
5
|
-
@connection = Bunny.new(:
|
5
|
+
@connection = Bunny.new(automatic_recovery: false).tap do |c|
|
6
6
|
c.start
|
7
7
|
end
|
8
8
|
end
|
@@ -42,7 +42,7 @@ describe "Rapidly opening and closing lots of channels" do
|
|
42
42
|
n.times do
|
43
43
|
t = Thread.new do
|
44
44
|
ch1 = @connection.create_channel
|
45
|
-
q = ch1.queue("", :
|
45
|
+
q = ch1.queue("", exclusive: true)
|
46
46
|
q.delete
|
47
47
|
ch1.close
|
48
48
|
|
@@ -69,7 +69,7 @@ describe "Rapidly opening and closing lots of channels" do
|
|
69
69
|
t = Thread.new do
|
70
70
|
3.times do
|
71
71
|
ch = @connection.create_channel
|
72
|
-
x = ch.topic('bunny.stress.topics.t2', :
|
72
|
+
x = ch.topic('bunny.stress.topics.t2', durable: false)
|
73
73
|
ch.close
|
74
74
|
end
|
75
75
|
end
|
@@ -3,7 +3,8 @@ require "spec_helper"
|
|
3
3
|
unless ENV["CI"]
|
4
4
|
describe "Rapidly opening and closing lots of channels on a non-threaded connection" do
|
5
5
|
before :all do
|
6
|
-
@connection = Bunny.new(:
|
6
|
+
@connection = Bunny.new(username: "bunny_gem", password: "bunny_password", vhost: "bunny_testbed",
|
7
|
+
automatic_recovery: false, threaded: false)
|
7
8
|
@connection.start
|
8
9
|
end
|
9
10
|
|
@@ -4,8 +4,8 @@ require "spec_helper"
|
|
4
4
|
unless ENV["CI"]
|
5
5
|
describe "Concurrent consumers sharing a connection" do
|
6
6
|
before :all do
|
7
|
-
@connection = Bunny.new(:
|
8
|
-
:
|
7
|
+
@connection = Bunny.new(username: "bunny_gem", password: "bunny_password", vhost: "bunny_testbed",
|
8
|
+
automatic_recovery: false)
|
9
9
|
@connection.start
|
10
10
|
end
|
11
11
|
|
@@ -27,7 +27,7 @@ unless ENV["CI"]
|
|
27
27
|
ch0 = @connection.create_channel
|
28
28
|
ch0.confirm_select
|
29
29
|
body = "абвг"
|
30
|
-
x = ch0.topic("bunny.stress.concurrent.consumers.topic", :
|
30
|
+
x = ch0.topic("bunny.stress.concurrent.consumers.topic", durable: true)
|
31
31
|
|
32
32
|
chs = {}
|
33
33
|
n.times do |i|
|
@@ -39,8 +39,8 @@ unless ENV["CI"]
|
|
39
39
|
t = Thread.new do
|
40
40
|
cht = chs[i]
|
41
41
|
|
42
|
-
q = cht.queue("", :
|
43
|
-
q.bind(x.name, :
|
42
|
+
q = cht.queue("", exclusive: true)
|
43
|
+
q.bind(x.name, routing_key: colors.sample).subscribe do |delivery_info, meta, payload|
|
44
44
|
# no-op
|
45
45
|
end
|
46
46
|
qs << q
|
@@ -52,7 +52,7 @@ unless ENV["CI"]
|
|
52
52
|
|
53
53
|
5.times do |i|
|
54
54
|
m.times do
|
55
|
-
x.publish(body, :
|
55
|
+
x.publish(body, routing_key: colors.sample)
|
56
56
|
end
|
57
57
|
puts "Published #{(i + 1) * m} messages..."
|
58
58
|
ch0.wait_for_confirms
|
@@ -4,7 +4,8 @@ require "spec_helper"
|
|
4
4
|
unless ENV["CI"]
|
5
5
|
describe "Concurrent publishers sharing a connection" do
|
6
6
|
before :all do
|
7
|
-
@connection = Bunny.new(:
|
7
|
+
@connection = Bunny.new(username: "bunny_gem", password: "bunny_password",
|
8
|
+
vhost: "bunny_testbed", automatically_recover: false)
|
8
9
|
@connection.start
|
9
10
|
end
|
10
11
|
|
@@ -13,7 +13,7 @@ unless defined?(JRUBY_VERSION) && !ENV["FORCE_JRUBY_RUN"]
|
|
13
13
|
|
14
14
|
n.times do |i|
|
15
15
|
it "can be closed (automatic recovery disabled, take #{i})" do
|
16
|
-
c = Bunny.new(:
|
16
|
+
c = Bunny.new(automatically_recover: false)
|
17
17
|
c.start
|
18
18
|
ch = c.create_channel
|
19
19
|
|
@@ -25,7 +25,7 @@ unless defined?(JRUBY_VERSION) && !ENV["FORCE_JRUBY_RUN"]
|
|
25
25
|
|
26
26
|
n.times do |i|
|
27
27
|
it "can be closed (automatic recovery enabled, take #{i})" do
|
28
|
-
c = Bunny.new(:
|
28
|
+
c = Bunny.new(automatically_recover: true)
|
29
29
|
c.start
|
30
30
|
ch = c.create_channel
|
31
31
|
|
@@ -38,7 +38,7 @@ unless defined?(JRUBY_VERSION) && !ENV["FORCE_JRUBY_RUN"]
|
|
38
38
|
context "in the single threaded mode" do
|
39
39
|
n.times do |i|
|
40
40
|
it "can be closed (single threaded mode, take #{i})" do
|
41
|
-
c = Bunny.new(:
|
41
|
+
c = Bunny.new(automatically_recover: false, threaded: false)
|
42
42
|
c.start
|
43
43
|
ch = c.create_channel
|
44
44
|
|