bunny 2.13.0 → 2.14.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.travis.yml +7 -4
- data/CONTRIBUTING.md +39 -26
- data/ChangeLog.md +46 -9
- data/Gemfile +0 -1
- data/LICENSE +1 -1
- data/README.md +2 -1
- data/Rakefile +8 -0
- data/bunny.gemspec +4 -4
- data/docker-compose.yml +3 -3
- data/docker/Dockerfile +11 -7
- data/docker/apt/preferences.d/erlang +3 -0
- data/docker/apt/sources.list.d/bintray.rabbitmq.list +2 -0
- data/docker/docker-entrypoint.sh +4 -15
- data/docker/rabbitmq.conf +29 -0
- data/lib/bunny/session.rb +29 -9
- data/lib/bunny/test_kit.rb +14 -0
- data/lib/bunny/transport.rb +50 -7
- data/lib/bunny/version.rb +1 -1
- data/spec/config/rabbitmq.conf +13 -0
- data/spec/higher_level_api/integration/channel_close_spec.rb +6 -2
- data/spec/higher_level_api/integration/connection_recovery_spec.rb +20 -8
- data/spec/higher_level_api/integration/queue_declare_spec.rb +56 -3
- data/spec/higher_level_api/integration/toxiproxy_spec.rb +5 -4
- data/spec/spec_helper.rb +1 -0
- data/spec/stress/merry_go_round_spec.rb +105 -0
- metadata +13 -15
- data/spec/config/rabbitmq.config +0 -19
- data/spec/higher_level_api/integration/merry_go_round_spec.rb +0 -85
- data/spec/stress/long_running_consumer_spec.rb +0 -84
data/spec/config/rabbitmq.config
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
[
|
2
|
-
|
3
|
-
{rabbit, [
|
4
|
-
{ssl_listeners, [5671]},
|
5
|
-
{ssl_options, [{cacertfile,"/spec/tls/ca_certificate.pem"},
|
6
|
-
{certfile,"/spec/tls/server_certificate.pem"},
|
7
|
-
{keyfile,"/spec/tls/server_key.pem"},
|
8
|
-
{verify,verify_none},
|
9
|
-
{fail_if_no_peer_cert,false}]},
|
10
|
-
{loopback_users, []}
|
11
|
-
] },
|
12
|
-
|
13
|
-
{rabbitmq_management,
|
14
|
-
[{listener,
|
15
|
-
[{port, 15672}]
|
16
|
-
}]
|
17
|
-
}
|
18
|
-
|
19
|
-
].
|
@@ -1,85 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "A message that is proxied by multiple intermediate consumers" do
|
4
|
-
let(:c1) do
|
5
|
-
c = Bunny.new(username: "bunny_gem", password: "bunny_password", vhost: "bunny_testbed")
|
6
|
-
c.start
|
7
|
-
c
|
8
|
-
end
|
9
|
-
|
10
|
-
let(:c2) do
|
11
|
-
c = Bunny.new(username: "bunny_gem", password: "bunny_password", vhost: "bunny_testbed")
|
12
|
-
c.start
|
13
|
-
c
|
14
|
-
end
|
15
|
-
|
16
|
-
let(:c3) do
|
17
|
-
c = Bunny.new(username: "bunny_gem", password: "bunny_password", vhost: "bunny_testbed")
|
18
|
-
c.start
|
19
|
-
c
|
20
|
-
end
|
21
|
-
|
22
|
-
let(:c4) do
|
23
|
-
c = Bunny.new(username: "bunny_gem", password: "bunny_password", vhost: "bunny_testbed")
|
24
|
-
c.start
|
25
|
-
c
|
26
|
-
end
|
27
|
-
|
28
|
-
let(:c5) do
|
29
|
-
c = Bunny.new(username: "bunny_gem", password: "bunny_password", vhost: "bunny_testbed")
|
30
|
-
c.start
|
31
|
-
c
|
32
|
-
end
|
33
|
-
|
34
|
-
after :each do
|
35
|
-
[c1, c2, c3, c4, c5].each do |c|
|
36
|
-
c.close if c.open?
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
# message flow is as follows:
|
41
|
-
#
|
42
|
-
# x => q4 => q3 => q2 => q1 => xs (results)
|
43
|
-
it "reaches its final destination" do
|
44
|
-
n = 10000
|
45
|
-
xs = []
|
46
|
-
|
47
|
-
ch1 = c1.create_channel
|
48
|
-
q1 = ch1.queue("", exclusive: true)
|
49
|
-
q1.subscribe do |_, _, payload|
|
50
|
-
xs << payload
|
51
|
-
end
|
52
|
-
|
53
|
-
ch2 = c2.create_channel
|
54
|
-
q2 = ch2.queue("", exclusive: true)
|
55
|
-
q2.subscribe do |_, _, payload|
|
56
|
-
q1.publish(payload)
|
57
|
-
end
|
58
|
-
|
59
|
-
ch3 = c3.create_channel
|
60
|
-
q3 = ch2.queue("", exclusive: true)
|
61
|
-
q3.subscribe do |_, _, payload|
|
62
|
-
q2.publish(payload)
|
63
|
-
end
|
64
|
-
|
65
|
-
ch4 = c4.create_channel
|
66
|
-
q4 = ch2.queue("", exclusive: true)
|
67
|
-
q4.subscribe do |_, _, payload|
|
68
|
-
q3.publish(payload)
|
69
|
-
end
|
70
|
-
|
71
|
-
ch5 = c5.create_channel
|
72
|
-
x = ch5.default_exchange
|
73
|
-
|
74
|
-
n.times do |i|
|
75
|
-
x.publish("msg #{i}", routing_key: q4.name)
|
76
|
-
end
|
77
|
-
|
78
|
-
t = n / 1000 * 3.0
|
79
|
-
puts "About to sleep for #{t} seconds..."
|
80
|
-
sleep(t)
|
81
|
-
|
82
|
-
expect(xs.size).to eq n
|
83
|
-
expect(xs.last).to eq "msg #{n - 1}"
|
84
|
-
end
|
85
|
-
end
|
@@ -1,84 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require "spec_helper"
|
3
|
-
|
4
|
-
unless ENV["CI"]
|
5
|
-
require "bunny/concurrent/condition"
|
6
|
-
require "bunny/test_kit"
|
7
|
-
|
8
|
-
describe "Long running [relatively to heartbeat interval] consumer that never publishes" do
|
9
|
-
before :all do
|
10
|
-
@connection = Bunny.new(username: "bunny_gem",
|
11
|
-
password: "bunny_password", vhost: "bunny_testbed",
|
12
|
-
automatic_recovery: false, heartbeat_timeout: 6)
|
13
|
-
@connection.start
|
14
|
-
end
|
15
|
-
|
16
|
-
after :all do
|
17
|
-
@connection.close
|
18
|
-
end
|
19
|
-
|
20
|
-
let(:target) { 256 * 1024 * 1024 }
|
21
|
-
let(:queue) { "bunny.stress.long_running_consumer.#{Time.now.to_i}" }
|
22
|
-
|
23
|
-
let(:rate) { 50 }
|
24
|
-
let(:s) { 4.0 }
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
it "does not skip heartbeats" do
|
29
|
-
finished = Bunny::Concurrent::Condition.new
|
30
|
-
|
31
|
-
ct = Thread.new do
|
32
|
-
t = 0
|
33
|
-
ch = @connection.create_channel(nil, 6)
|
34
|
-
begin
|
35
|
-
q = ch.queue(queue, exclusive: true)
|
36
|
-
|
37
|
-
q.bind("amq.fanout").subscribe do |_, _, payload|
|
38
|
-
t += payload.bytesize
|
39
|
-
|
40
|
-
if t >= target
|
41
|
-
puts "Hit the target, done with the test..."
|
42
|
-
|
43
|
-
finished.notify_all
|
44
|
-
else
|
45
|
-
puts "Consumed #{(t.to_f / target.to_f).round(3) * 100}% of data"
|
46
|
-
end
|
47
|
-
end
|
48
|
-
rescue Interrupt => e
|
49
|
-
ch.maybe_kill_consumer_work_pool!
|
50
|
-
ch.close rescue nil
|
51
|
-
end
|
52
|
-
end
|
53
|
-
ct.abort_on_exception = true
|
54
|
-
|
55
|
-
pt = Thread.new do
|
56
|
-
t = 0
|
57
|
-
ch = @connection.create_channel
|
58
|
-
begin
|
59
|
-
x = ch.fanout("amq.fanout")
|
60
|
-
|
61
|
-
loop do
|
62
|
-
break if t >= target
|
63
|
-
|
64
|
-
rate.times do |i|
|
65
|
-
msg = Bunny::TestKit.message_in_kb(96, 8192, i)
|
66
|
-
x.publish(msg)
|
67
|
-
t += msg.bytesize
|
68
|
-
end
|
69
|
-
|
70
|
-
sleep (s * rand)
|
71
|
-
end
|
72
|
-
rescue Interrupt => e
|
73
|
-
ch.close rescue nil
|
74
|
-
end
|
75
|
-
end
|
76
|
-
pt.abort_on_exception = true
|
77
|
-
|
78
|
-
finished.wait
|
79
|
-
|
80
|
-
ct.raise Interrupt.new
|
81
|
-
pt.raise Interrupt.new
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|