bunny 2.6.3 → 2.6.4
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -78,7 +78,7 @@ describe Bunny::Session do
|
|
78
78
|
unless ENV["CI"]
|
79
79
|
context "initialized with TCP connection timeout = 5" do
|
80
80
|
it "successfully connects" do
|
81
|
-
conn = described_class.new(:
|
81
|
+
conn = described_class.new(connection_timeout: 5)
|
82
82
|
conn.start
|
83
83
|
expect(conn).to be_connected
|
84
84
|
|
@@ -95,14 +95,14 @@ describe Bunny::Session do
|
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
|
-
context "initialized with :
|
98
|
+
context "initialized with hostname: 127.0.0.1" do
|
99
99
|
after :each do
|
100
100
|
subject.close if subject.open?
|
101
101
|
end
|
102
102
|
|
103
103
|
let(:host) { "127.0.0.1" }
|
104
104
|
subject do
|
105
|
-
described_class.new(:
|
105
|
+
described_class.new(hostname: host)
|
106
106
|
end
|
107
107
|
|
108
108
|
it "uses hostname = 127.0.0.1" do
|
@@ -119,13 +119,13 @@ describe Bunny::Session do
|
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
|
-
context "initialized with :
|
122
|
+
context "initialized with hostname: localhost" do
|
123
123
|
after :each do
|
124
124
|
subject.close if subject.open?
|
125
125
|
end
|
126
126
|
|
127
127
|
let(:host) { "localhost" }
|
128
|
-
let(:subject) { described_class.new(:
|
128
|
+
let(:subject) { described_class.new(hostname: host) }
|
129
129
|
|
130
130
|
it "uses hostname = localhost" do
|
131
131
|
expect(subject.host).to eq host
|
@@ -142,14 +142,14 @@ describe Bunny::Session do
|
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
|
-
context "initialized with
|
145
|
+
context "initialized with a list of hosts" do
|
146
146
|
after :each do
|
147
147
|
subject.close if subject.open?
|
148
148
|
end
|
149
149
|
|
150
150
|
let(:host) { "192.168.1.10" }
|
151
151
|
let(:hosts) { [host] }
|
152
|
-
let(:subject) { described_class.new(:
|
152
|
+
let(:subject) { described_class.new(hosts: hosts) }
|
153
153
|
|
154
154
|
it "uses hostname = 192.168.1.10" do
|
155
155
|
expect(subject.host).to eq host
|
@@ -166,7 +166,7 @@ describe Bunny::Session do
|
|
166
166
|
end
|
167
167
|
end
|
168
168
|
|
169
|
-
context "initialized with
|
169
|
+
context "initialized with a list of addresses" do
|
170
170
|
after :each do
|
171
171
|
subject.close if subject.open?
|
172
172
|
end
|
@@ -175,7 +175,7 @@ describe Bunny::Session do
|
|
175
175
|
let(:port) { 5673 }
|
176
176
|
let(:address) { "#{host}:#{port}" }
|
177
177
|
let(:addresses) { [address] }
|
178
|
-
let(:subject) { described_class.new(:
|
178
|
+
let(:subject) { described_class.new(addresses: addresses) }
|
179
179
|
|
180
180
|
it "uses hostname = 192.168.1.10" do
|
181
181
|
expect(subject.host).to eq host
|
@@ -192,7 +192,7 @@ describe Bunny::Session do
|
|
192
192
|
end
|
193
193
|
end
|
194
194
|
|
195
|
-
context "initialized with :
|
195
|
+
context "initialized with addresses: [...] with quoted IPv6 hostnames" do
|
196
196
|
after :each do
|
197
197
|
subject.close if subject.open?
|
198
198
|
end
|
@@ -201,7 +201,7 @@ describe Bunny::Session do
|
|
201
201
|
let(:port) { 5673 }
|
202
202
|
let(:address) { "#{host}:#{port}" }
|
203
203
|
let(:addresses) { [address] }
|
204
|
-
let(:subject) { described_class.new(:
|
204
|
+
let(:subject) { described_class.new(addresses: addresses) }
|
205
205
|
|
206
206
|
it "uses correct hostname" do
|
207
207
|
expect(subject.host).to eq host
|
@@ -218,7 +218,7 @@ describe Bunny::Session do
|
|
218
218
|
end
|
219
219
|
end
|
220
220
|
|
221
|
-
context "initialized with :
|
221
|
+
context "initialized with addresses: [...] with quoted IPv6 hostnames without ports" do
|
222
222
|
after :each do
|
223
223
|
subject.close if subject.open?
|
224
224
|
end
|
@@ -226,7 +226,7 @@ describe Bunny::Session do
|
|
226
226
|
let(:host) { "[2001:db8:85a3:8d3:1319:8a2e:370:7348]" }
|
227
227
|
let(:address) { host }
|
228
228
|
let(:addresses) { [address] }
|
229
|
-
let(:subject) { described_class.new(:
|
229
|
+
let(:subject) { described_class.new(addresses: addresses) }
|
230
230
|
|
231
231
|
it "uses correct hostname" do
|
232
232
|
expect(subject.host).to eq host
|
@@ -243,7 +243,7 @@ describe Bunny::Session do
|
|
243
243
|
end
|
244
244
|
end
|
245
245
|
|
246
|
-
context "initialized with :
|
246
|
+
context "initialized with addresses: [...] with an quoted IPv6 hostnames" do
|
247
247
|
after :each do
|
248
248
|
subject.close if subject.open?
|
249
249
|
end
|
@@ -252,7 +252,7 @@ describe Bunny::Session do
|
|
252
252
|
let(:port) { 5673 }
|
253
253
|
let(:address) { "#{host}:#{port}" }
|
254
254
|
let(:addresses) { [address] }
|
255
|
-
let(:subject) { described_class.new(:
|
255
|
+
let(:subject) { described_class.new(addresses: addresses) }
|
256
256
|
|
257
257
|
it "fails to correctly parse the host (and emits a warning)" do
|
258
258
|
expect(subject.host).to eq "2001"
|
@@ -294,13 +294,13 @@ describe Bunny::Session do
|
|
294
294
|
end
|
295
295
|
end
|
296
296
|
|
297
|
-
context "initialized with :
|
297
|
+
context "initialized with channel_max: 4096" do
|
298
298
|
after :each do
|
299
299
|
subject.close if subject.open?
|
300
300
|
end
|
301
301
|
|
302
302
|
let(:channel_max) { 1024 }
|
303
|
-
let(:subject) { described_class.new(:
|
303
|
+
let(:subject) { described_class.new(channel_max: channel_max) }
|
304
304
|
|
305
305
|
# this assumes RabbitMQ has no lower value configured. In 3.2
|
306
306
|
# it is 0 (no limit) by default and 1024 is still a fairly low value
|
@@ -313,15 +313,15 @@ describe Bunny::Session do
|
|
313
313
|
end
|
314
314
|
end
|
315
315
|
|
316
|
-
context "initialized with :
|
316
|
+
context "initialized with ssl: true" do
|
317
317
|
let(:subject) do
|
318
|
-
described_class.new(:
|
319
|
-
:
|
320
|
-
:
|
321
|
-
:
|
322
|
-
:
|
323
|
-
:
|
324
|
-
:
|
318
|
+
described_class.new(username: "bunny_gem",
|
319
|
+
password: "bunny_password",
|
320
|
+
vhost: "bunny_testbed",
|
321
|
+
ssl: true,
|
322
|
+
ssl_cert: "spec/tls/client_cert.pem",
|
323
|
+
ssl_key: "spec/tls/client_key.pem",
|
324
|
+
ssl_ca_certificates: ["./spec/tls/cacert.pem"])
|
325
325
|
end
|
326
326
|
|
327
327
|
it "uses TLS port" do
|
@@ -329,15 +329,15 @@ describe Bunny::Session do
|
|
329
329
|
end
|
330
330
|
end
|
331
331
|
|
332
|
-
context "initialized with :
|
332
|
+
context "initialized with tls: true" do
|
333
333
|
let(:subject) do
|
334
|
-
described_class.new(:
|
335
|
-
:
|
336
|
-
:
|
337
|
-
:
|
338
|
-
:
|
339
|
-
:
|
340
|
-
:
|
334
|
+
described_class.new(username: "bunny_gem",
|
335
|
+
password: "bunny_password",
|
336
|
+
vhost: "bunny_testbed",
|
337
|
+
tls: true,
|
338
|
+
tls_cert: "spec/tls/client_certificate.pem",
|
339
|
+
tls_key: "spec/tls/client_key.pem",
|
340
|
+
tls_ca_certificates: ["./spec/tls/ca_certificate.pem"])
|
341
341
|
end
|
342
342
|
|
343
343
|
it "uses TLS port" do
|
@@ -346,7 +346,7 @@ describe Bunny::Session do
|
|
346
346
|
end
|
347
347
|
end
|
348
348
|
|
349
|
-
context "initialized with :
|
349
|
+
context "initialized with hostname: 127.0.0.1 and non-default credentials" do
|
350
350
|
after :each do
|
351
351
|
subject.close if subject.open?
|
352
352
|
end
|
@@ -358,7 +358,7 @@ describe Bunny::Session do
|
|
358
358
|
let(:vhost) { "bunny_testbed" }
|
359
359
|
|
360
360
|
subject do
|
361
|
-
described_class.new(:
|
361
|
+
described_class.new(hostname: host, username: username, password: password, virtual_host: vhost)
|
362
362
|
end
|
363
363
|
|
364
364
|
it "successfully connects" do
|
@@ -398,7 +398,7 @@ describe Bunny::Session do
|
|
398
398
|
end
|
399
399
|
end
|
400
400
|
|
401
|
-
context "initialized with :
|
401
|
+
context "initialized with hostname: 127.0.0.1 and non-default credentials (take 2)" do
|
402
402
|
after :each do
|
403
403
|
subject.close if subject.open?
|
404
404
|
end
|
@@ -410,7 +410,7 @@ describe Bunny::Session do
|
|
410
410
|
let(:vhost) { "bunny_testbed" }
|
411
411
|
|
412
412
|
subject do
|
413
|
-
described_class.new(:
|
413
|
+
described_class.new(hostname: host, username: username, password: password, vhost: vhost)
|
414
414
|
end
|
415
415
|
|
416
416
|
it "successfully connects" do
|
@@ -445,7 +445,7 @@ describe Bunny::Session do
|
|
445
445
|
end
|
446
446
|
end
|
447
447
|
|
448
|
-
context "initialized with :
|
448
|
+
context "initialized with hostname: 127.0.0.1 and non-default credentials (take 2)" do
|
449
449
|
after :each do
|
450
450
|
subject.close if subject.open?
|
451
451
|
end
|
@@ -458,7 +458,7 @@ describe Bunny::Session do
|
|
458
458
|
let(:interval) { 1 }
|
459
459
|
|
460
460
|
subject do
|
461
|
-
described_class.new(:
|
461
|
+
described_class.new(hostname: host, username: username, password: password, vhost: vhost, heartbeat_interval: interval)
|
462
462
|
end
|
463
463
|
|
464
464
|
it "successfully connects" do
|
@@ -481,7 +481,7 @@ describe Bunny::Session do
|
|
481
481
|
end
|
482
482
|
end
|
483
483
|
|
484
|
-
context "initialized with :
|
484
|
+
context "initialized with hostname: 127.0.0.1 and INVALID credentials" do
|
485
485
|
let(:host) { "127.0.0.1" }
|
486
486
|
# see ./bin/ci/before_build
|
487
487
|
let(:username) { "bunny_gem#{Time.now.to_i}" }
|
@@ -489,7 +489,7 @@ describe Bunny::Session do
|
|
489
489
|
let(:vhost) { "___sd89aysd98789" }
|
490
490
|
|
491
491
|
subject do
|
492
|
-
described_class.new(:
|
492
|
+
described_class.new(hostname: host, username: username, password: password, vhost: vhost)
|
493
493
|
end
|
494
494
|
|
495
495
|
it "fails to connect" do
|
@@ -510,14 +510,14 @@ describe Bunny::Session do
|
|
510
510
|
context "initialized with unreachable host or port" do
|
511
511
|
it "fails to connect" do
|
512
512
|
expect do
|
513
|
-
c = described_class.new(:
|
513
|
+
c = described_class.new(port: 38000)
|
514
514
|
c.start
|
515
515
|
end.to raise_error(Bunny::TCPConnectionFailed)
|
516
516
|
end
|
517
517
|
|
518
518
|
it "is not connected" do
|
519
519
|
begin
|
520
|
-
c = described_class.new(:
|
520
|
+
c = described_class.new(port: 38000)
|
521
521
|
c.start
|
522
522
|
rescue Bunny::TCPConnectionFailed => e
|
523
523
|
true
|
@@ -528,7 +528,7 @@ describe Bunny::Session do
|
|
528
528
|
|
529
529
|
it "is not open" do
|
530
530
|
begin
|
531
|
-
c = described_class.new(:
|
531
|
+
c = described_class.new(port: 38000)
|
532
532
|
c.start
|
533
533
|
rescue Bunny::TCPConnectionFailed => e
|
534
534
|
true
|
@@ -543,7 +543,7 @@ describe Bunny::Session do
|
|
543
543
|
let(:logger) { ::Logger.new(io) }
|
544
544
|
|
545
545
|
it "uses provided logger" do
|
546
|
-
conn = described_class.new(:
|
546
|
+
conn = described_class.new(logger: logger)
|
547
547
|
conn.start
|
548
548
|
|
549
549
|
expect(io.string.length).to be > 100
|
@@ -553,7 +553,7 @@ describe Bunny::Session do
|
|
553
553
|
|
554
554
|
it "doesn't reassign the logger's progname attribute" do
|
555
555
|
expect(logger).not_to receive(:progname=)
|
556
|
-
described_class.new(:
|
556
|
+
described_class.new(logger: logger)
|
557
557
|
end
|
558
558
|
end
|
559
559
|
end
|
@@ -6,9 +6,9 @@ describe Bunny::Session do
|
|
6
6
|
def close_connection(client_port)
|
7
7
|
c = http_client.
|
8
8
|
list_connections.
|
9
|
-
find { |conn_info| conn_info.peer_port.to_i == client_port }
|
9
|
+
find { |conn_info| conn_info && conn_info.peer_port.to_i == client_port }
|
10
10
|
|
11
|
-
http_client.close_connection(c.name)
|
11
|
+
http_client.close_connection(c.name) if c
|
12
12
|
end
|
13
13
|
|
14
14
|
def wait_for_recovery
|
@@ -16,7 +16,7 @@ describe Bunny::Session do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it "can be closed" do
|
19
|
-
c = Bunny.new(:
|
19
|
+
c = Bunny.new(automatically_recover: false)
|
20
20
|
c.start
|
21
21
|
ch = c.create_channel
|
22
22
|
|
@@ -26,7 +26,7 @@ describe Bunny::Session do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
it "can be closed twice (Session#close is idempotent)" do
|
29
|
-
c = Bunny.new(:
|
29
|
+
c = Bunny.new(automatically_recover: false)
|
30
30
|
c.start
|
31
31
|
ch = c.create_channel
|
32
32
|
|
@@ -39,7 +39,7 @@ describe Bunny::Session do
|
|
39
39
|
|
40
40
|
describe "in a single threaded mode" do
|
41
41
|
it "can be closed" do
|
42
|
-
c = Bunny.new(:
|
42
|
+
c = Bunny.new(automatically_recover: false, threaded: false)
|
43
43
|
c.start
|
44
44
|
ch = c.create_channel
|
45
45
|
|
@@ -52,14 +52,15 @@ describe Bunny::Session do
|
|
52
52
|
|
53
53
|
describe "that recovers from connection.close" do
|
54
54
|
it "can be closed" do
|
55
|
-
c = Bunny.new(
|
55
|
+
c = Bunny.new(automatically_recover: true,
|
56
|
+
recover_from_connection_close: true,
|
57
|
+
network_recovery_interval: 0.2)
|
56
58
|
c.start
|
57
59
|
ch = c.create_channel
|
58
60
|
|
59
61
|
expect(c).to be_open
|
62
|
+
sleep 1.5
|
60
63
|
close_connection(c.local_port)
|
61
|
-
sleep 0.2
|
62
|
-
expect(c).not_to be_open
|
63
64
|
|
64
65
|
wait_for_recovery
|
65
66
|
expect(c).to be_open
|
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Bunny::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
|
@@ -20,18 +20,18 @@ describe Bunny::Channel do
|
|
20
20
|
ch = connection.create_channel
|
21
21
|
t = Thread.new do
|
22
22
|
ch2 = connection.create_channel
|
23
|
-
q = ch2.queue(queue_name, :
|
23
|
+
q = ch2.queue(queue_name, auto_delete: true)
|
24
24
|
|
25
|
-
q.subscribe(:
|
25
|
+
q.subscribe(on_cancellation: Proc.new { cancelled = true })
|
26
26
|
end
|
27
27
|
t.abort_on_exception = true
|
28
28
|
|
29
29
|
sleep 0.5
|
30
30
|
x = ch.default_exchange
|
31
|
-
x.publish("abc", :
|
31
|
+
x.publish("abc", routing_key: queue_name)
|
32
32
|
|
33
33
|
sleep 0.5
|
34
|
-
ch.queue(queue_name, :
|
34
|
+
ch.queue(queue_name, auto_delete: true).delete
|
35
35
|
|
36
36
|
sleep 0.5
|
37
37
|
expect(cancelled).to eq true
|
@@ -60,7 +60,7 @@ describe Bunny::Channel do
|
|
60
60
|
ch = connection.create_channel
|
61
61
|
t = Thread.new do
|
62
62
|
ch2 = connection.create_channel
|
63
|
-
q = ch2.queue(queue_name, :
|
63
|
+
q = ch2.queue(queue_name, auto_delete: true)
|
64
64
|
|
65
65
|
consumer = ExampleConsumer.new(ch2, q, "")
|
66
66
|
q.subscribe_with(consumer)
|
@@ -69,10 +69,10 @@ describe Bunny::Channel do
|
|
69
69
|
|
70
70
|
sleep 0.5
|
71
71
|
x = ch.default_exchange
|
72
|
-
x.publish("abc", :
|
72
|
+
x.publish("abc", routing_key: queue_name)
|
73
73
|
|
74
74
|
sleep 0.5
|
75
|
-
ch.queue(queue_name, :
|
75
|
+
ch.queue(queue_name, auto_delete: true).delete
|
76
76
|
|
77
77
|
sleep 0.5
|
78
78
|
expect(consumer).to be_cancelled
|
@@ -86,7 +86,7 @@ describe Bunny::Channel do
|
|
86
86
|
context "with consumer re-registration" do
|
87
87
|
class ExampleConsumerThatReregisters < Bunny::Consumer
|
88
88
|
def handle_cancellation(_)
|
89
|
-
@queue = @channel.queue("basic.consume.after_cancellation", :
|
89
|
+
@queue = @channel.queue("basic.consume.after_cancellation", auto_delete: true)
|
90
90
|
@channel.basic_consume_with(self)
|
91
91
|
end
|
92
92
|
end
|
@@ -100,7 +100,7 @@ describe Bunny::Channel do
|
|
100
100
|
ch = connection.create_channel
|
101
101
|
t = Thread.new do
|
102
102
|
ch2 = connection.create_channel
|
103
|
-
q = ch2.queue(queue_name, :
|
103
|
+
q = ch2.queue(queue_name, auto_delete: true)
|
104
104
|
|
105
105
|
consumer = ExampleConsumerThatReregisters.new(ch2, q, "")
|
106
106
|
consumer.on_delivery do |_, _, payload|
|
@@ -112,14 +112,14 @@ describe Bunny::Channel do
|
|
112
112
|
|
113
113
|
sleep 0.5
|
114
114
|
x = ch.default_exchange
|
115
|
-
x.publish("abc", :
|
115
|
+
x.publish("abc", routing_key: queue_name)
|
116
116
|
|
117
117
|
sleep 0.5
|
118
|
-
ch.queue(queue_name, :
|
118
|
+
ch.queue(queue_name, auto_delete: true).delete
|
119
119
|
|
120
|
-
x.publish("abc", :
|
120
|
+
x.publish("abc", routing_key: queue_name)
|
121
121
|
sleep 0.5
|
122
|
-
q = ch.queue("basic.consume.after_cancellation", :
|
122
|
+
q = ch.queue("basic.consume.after_cancellation", auto_delete: true)
|
123
123
|
expect(xs).to eq ["abc"]
|
124
124
|
|
125
125
|
ch.close
|
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe "A message" 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
|
@@ -15,14 +15,14 @@ describe "A message" do
|
|
15
15
|
ch = connection.create_channel
|
16
16
|
x = ch.fanout("amq.fanout")
|
17
17
|
dlx = ch.fanout("bunny.tests.dlx.exchange")
|
18
|
-
q = ch.queue("", :
|
18
|
+
q = ch.queue("", exclusive: true, arguments: {"x-dead-letter-exchange" => dlx.name}).bind(x)
|
19
19
|
# dead letter queue
|
20
|
-
dlq = ch.queue("", :
|
20
|
+
dlq = ch.queue("", exclusive: true).bind(dlx)
|
21
21
|
|
22
22
|
x.publish("")
|
23
23
|
sleep 0.2
|
24
24
|
|
25
|
-
delivery_info, _, _ = q.pop(:
|
25
|
+
delivery_info, _, _ = q.pop(manual_ack: true)
|
26
26
|
expect(dlq.message_count).to be_zero
|
27
27
|
ch.nack(delivery_info.delivery_tag)
|
28
28
|
|
@@ -41,9 +41,9 @@ describe "A message" do
|
|
41
41
|
ch = connection.create_channel
|
42
42
|
x = ch.fanout("amq.fanout")
|
43
43
|
dlx = ch.fanout("bunny.tests.dlx.exchange")
|
44
|
-
q = ch.queue("", :
|
44
|
+
q = ch.queue("", exclusive: true, arguments: {"x-dead-letter-exchange" => dlx.name, "x-message-ttl" => 100}).bind(x)
|
45
45
|
# dead letter queue
|
46
|
-
dlq = ch.queue("", :
|
46
|
+
dlq = ch.queue("", exclusive: true).bind(dlx)
|
47
47
|
|
48
48
|
x.publish("")
|
49
49
|
sleep 0.2
|
@@ -58,9 +58,9 @@ describe "A message" do
|
|
58
58
|
ch = connection.create_channel
|
59
59
|
x = ch.fanout("amq.fanout")
|
60
60
|
dlx = ch.fanout("bunny.tests.dlx.exchange")
|
61
|
-
q = ch.queue("", :
|
61
|
+
q = ch.queue("", exclusive: true, arguments: {"x-dead-letter-exchange" => dlx.name, "x-message-ttl" => 100}).bind(x)
|
62
62
|
# dead letter queue
|
63
|
-
dlq = ch.queue("", :
|
63
|
+
dlq = ch.queue("", exclusive: true).bind(dlx)
|
64
64
|
|
65
65
|
x.publish("")
|
66
66
|
sleep 0.2
|