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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 656044a49b0519951d33968f7a0fd45e5fd34e7e11390204368ca2c044e1a32e
|
4
|
+
data.tar.gz: 6a3235983cd9614cafc653985dc65eb99b525e3019380d3b06c235f7d0b2db06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7072cf0f324b6455ca955c8622c1b1811f8b4554ef01ca87c5c31eb1d4ae39f9674433478ce180704130dd143798a95c65d944182a6faee4789ea72cfb64727
|
7
|
+
data.tar.gz: dbf6d87e2a7bc49efb13661463458477b547f5f3044933416684f770208b62d5c73c9b47bf60f863c7a00d66e45a5d2d357a6243de2230d64b0ace81976a7ed7
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -3,14 +3,17 @@ bundler_args: --without development
|
|
3
3
|
cache: bundler
|
4
4
|
before_install:
|
5
5
|
- gem install bundler
|
6
|
-
before_script:
|
6
|
+
before_script:
|
7
|
+
- "./bin/ci/install_on_debian.sh"
|
8
|
+
- until sudo lsof -i:5672; do echo "Waiting for RabbitMQ to start..."; sleep 1; done
|
9
|
+
- "./bin/ci/before_build.sh"
|
7
10
|
script: "bundle exec rake integration_without_recovery"
|
8
11
|
rvm:
|
9
12
|
- ruby-head
|
13
|
+
- "2.6.0"
|
10
14
|
- "2.5.1"
|
11
15
|
- "2.4.2"
|
12
16
|
- "2.3.5"
|
13
|
-
- "2.2.8"
|
14
17
|
notifications:
|
15
18
|
email: michael@rabbitmq.com
|
16
19
|
services:
|
@@ -18,8 +21,8 @@ services:
|
|
18
21
|
branches:
|
19
22
|
only:
|
20
23
|
- master
|
21
|
-
- 2.
|
22
|
-
- 2.
|
24
|
+
- 2.12.x-stable
|
25
|
+
- 2.11.x-stable
|
23
26
|
env:
|
24
27
|
- CI=true
|
25
28
|
matrix:
|
data/CONTRIBUTING.md
CHANGED
@@ -6,10 +6,10 @@ Issues are appropriate for something specific enough for a maintainer or contrib
|
|
6
6
|
* There should be enough information to reproduce the behavior observed in a reasonable amount of time
|
7
7
|
* It should be reasonably clear why the behavior should be changed and why this cannot or should not be addressed
|
8
8
|
in application code, a separate library and so on
|
9
|
-
|
9
|
+
|
10
10
|
All issues that do not satisfy the above properties belong to the [Ruby RabbitMQ clients mailing list](http://groups.google.com/forum/#!forum/ruby-amqp). Pull request that do not satisfy them have a high chance
|
11
11
|
of being closed.
|
12
|
-
|
12
|
+
|
13
13
|
## Submitting a Pull Request
|
14
14
|
|
15
15
|
Please read the sections below to get an idea about how to run Bunny test suites first. Successfully
|
@@ -27,44 +27,47 @@ locally with the `rabbitmq-management` and `rabbitmq_consistent_hash_exchange` p
|
|
27
27
|
|
28
28
|
### Running the Specs
|
29
29
|
|
30
|
-
The specs require RabbitMQ to be running locally with a specific set of
|
30
|
+
The specs require RabbitMQ to be running locally with a specific set of virtual hosts
|
31
31
|
and users. RabbitMQ can be provisioned and started any way that's convenient to you
|
32
32
|
as long as it has a suitable TLS keys configuration and management plugin enabled.
|
33
|
-
Make sure you have a recent version of RabbitMQ (> `3.
|
33
|
+
Make sure you have a recent version of RabbitMQ (> `3.7.10`).
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
This can be done either by using a locally installed RabbitMQ server or by
|
38
|
-
running a RabbitMQ server in a Docker container.
|
35
|
+
The test suite can either use a locally available RabbitMQ node ([generic binary builds](http://www.rabbitmq.com/install-generic-unix.html)
|
36
|
+
are an option that works well) or by running a RabbitMQ server in a Docker container.
|
39
37
|
|
40
|
-
|
38
|
+
### Using a locally installed RabbitMQ node
|
41
39
|
|
42
40
|
It is possible to start a local RabbitMQ node from the repository root. It is not necessarily
|
43
41
|
optimal but can be a good starting point but is a useful example:
|
44
42
|
|
45
43
|
```
|
46
|
-
RABBITMQ_NODENAME=bunny RABBITMQ_CONFIG_FILE=./spec/config/rabbitmq RABBITMQ_ENABLED_PLUGINS_FILE=./spec/config/enabled_plugins rabbitmq-server
|
44
|
+
RABBITMQ_NODENAME=bunny RABBITMQ_CONFIG_FILE=./spec/config/rabbitmq.conf RABBITMQ_ENABLED_PLUGINS_FILE=./spec/config/enabled_plugins rabbitmq-server
|
47
45
|
```
|
48
46
|
|
49
|
-
The specs
|
50
|
-
be
|
51
|
-
|
52
|
-
|
53
|
-
|
47
|
+
The specs need the RabbitMQ management plugin to be enabled and include TLS connectivity tests,
|
48
|
+
so the node must be configured to use a [certificate and key pair](http://www.rabbitmq.com/ssl.html#certificates-and-keys).
|
49
|
+
The config and enabled plugin files in the spec/config directory take care of that
|
50
|
+
but certificates must be provisioned locally. By default there's a set of CA, server, and client certificates pre-generated at `spec/tls`.
|
51
|
+
|
52
|
+
The `BUNNY_CERTIFICATE_DIR` environment variable can be used to a directory containing a CA certificate
|
53
|
+
and a certificate/key pair to be used by the server. The directory can be generated using
|
54
|
+
[tls-gen](https://github.com/michaelklishin/tls-gen)'s basic profile. This option is recommended.
|
54
55
|
|
55
|
-
|
56
|
-
contain a hardcoded CN and your hostname is unlikely to match it,
|
57
|
-
the location can be overridden via the `BUNNY_CERTIFICATE_DIR` environment variable.
|
58
|
-
It is supposed to target [tls-gen](https://github.com/michaelklishin/tls-gen)'s basic profile
|
59
|
-
output (result) directory on the host where specs are to be executed. Combine it with `BUNNY_RABBITMQ_HOSTNAME`
|
60
|
-
when running TLS connection tests:
|
56
|
+
`BUNNY_RABBITMQ_HOSTNAME` can be used to override the expected server hostname for [peer verification](http://www.rabbitmq.com/ssl.html#peer-verification) in the TLS test suite:
|
61
57
|
|
62
58
|
```
|
63
59
|
BUNNY_CERTIFICATE_DIR="/path/to/tls-gen/basic/result" BUNNY_RABBITMQ_HOSTNAME="mayflower" bundle exec rspec
|
64
60
|
|
65
61
|
```
|
66
62
|
|
67
|
-
|
63
|
+
Certificates can be generated with [tls-gen](https://github.com/michaelklishin/tls-gen)'s basic profile.
|
64
|
+
In that case they include a Subject Alternative Name of `localhost` for improved portability.
|
65
|
+
|
66
|
+
|
67
|
+
### Node Setup
|
68
|
+
|
69
|
+
There is also a script that preconfigured the node for Bunny tests. It is sufficient to run
|
70
|
+
it once but if RabbitMQ is reset it has to be executed again:
|
68
71
|
|
69
72
|
```
|
70
73
|
RABBITMQ_NODENAME=bunny ./bin/ci/before_build
|
@@ -90,19 +93,29 @@ Version >= 1.6.0+ is required for compose version 2 syntax.
|
|
90
93
|
After those have been installed (and the `docker-compose` command is available on your command line path), run
|
91
94
|
|
92
95
|
```
|
93
|
-
docker-compose build && docker-compose
|
96
|
+
docker-compose build && docker-compose run --service-ports rabbitmq
|
94
97
|
```
|
95
98
|
|
96
99
|
The first time you do this, it will take some time, since it has to download everything it needs
|
97
100
|
to build the Docker image.
|
98
101
|
|
99
102
|
The RabbitMQ server will run in the foreground in the terminal where you started it. You can stop
|
100
|
-
it by pressing CTRL+C. If you want to run it in the background,
|
103
|
+
it by pressing CTRL+C. If you want to run it in the background, pass `-d` to `docker-compose`.
|
104
|
+
|
105
|
+
### Toxiproxy
|
106
|
+
|
107
|
+
If Toxiproxy is running locally on standard ports or started via Docker:
|
108
|
+
|
109
|
+
```
|
110
|
+
docker-compose run --service-ports toxiproxy
|
111
|
+
```
|
112
|
+
|
113
|
+
then Bunny will run additional resiliency tests.
|
101
114
|
|
102
115
|
### Running Test Suites
|
103
116
|
|
104
|
-
Prior to running the tests, configure the RabbitMQ permissions by running `./bin/ci/before_build`
|
105
|
-
if you have RabbitMQ locally installed, if you are running RabbitMQ via Docker as above this step
|
117
|
+
Prior to running the tests, configure the RabbitMQ permissions by running `./bin/ci/before_build`
|
118
|
+
if you have RabbitMQ locally installed, if you are running RabbitMQ via Docker as above this step
|
106
119
|
is not required as the setup is baked in.
|
107
120
|
|
108
121
|
Make sure you have those two installed and then run integration tests:
|
data/ChangeLog.md
CHANGED
@@ -1,7 +1,51 @@
|
|
1
|
-
## Changes between Bunny 2.
|
1
|
+
## Changes between Bunny 2.14.1 and 2.14.2 (unreleased)
|
2
2
|
|
3
3
|
No changes yet.
|
4
4
|
|
5
|
+
## Changes between Bunny 2.14.0 and 2.14.1 (Feb 26th, 2019)
|
6
|
+
|
7
|
+
### Gem Installation Fixed on Windows
|
8
|
+
|
9
|
+
`bin/ci`, a directory with symlinks, is no longer included into the gem.
|
10
|
+
|
11
|
+
Contributed by Jack Xiaosong Xu.
|
12
|
+
|
13
|
+
GitHub issue: [#573](https://github.com/ruby-amqp/bunny/pull/574)
|
14
|
+
|
15
|
+
## Changes between Bunny 2.13.0 and 2.14.0 (Feb 20th, 2019)
|
16
|
+
|
17
|
+
### Improved Peer Verification Failure Logging
|
18
|
+
|
19
|
+
When [peer verification](https://www.rabbitmq.com/ssl.html#peer-verification) fails, the connection will now log
|
20
|
+
some relevant peer certificate chain details. If Bunny
|
21
|
+
log level is set to `debug`, the same information will be logged
|
22
|
+
unconditionally.
|
23
|
+
|
24
|
+
### Closing Connections without Waiting for Response
|
25
|
+
|
26
|
+
`Bunny::Session#close` now accepts a parameter that controls whether
|
27
|
+
it waits for a `connection.close-ok` frame. Not waiting is useful
|
28
|
+
when it is known for a fact that the node might not respond
|
29
|
+
(it might be shutting down, connection is known to be interrupted
|
30
|
+
or unrecoverable and so on) or waiting is irrelevant to the caller.
|
31
|
+
|
32
|
+
### Successful Connection Recovery Notification
|
33
|
+
|
34
|
+
`Bunny::Session#after_recovery_completed` (accepts a block)
|
35
|
+
and a new connection option, `:recovery_completed` (a callable object)
|
36
|
+
can be used to react to successful connection and topology recovery.
|
37
|
+
|
38
|
+
GitHub issue: [#573](https://github.com/ruby-amqp/bunny/pull/573).
|
39
|
+
|
40
|
+
Contributed by Ionut Popa.
|
41
|
+
|
42
|
+
### effin_utf8 Dependency Dropped
|
43
|
+
|
44
|
+
This library no longer supports Ruby 1.8 and thus
|
45
|
+
doesn't need to depend on the `effin_utf8` gem.
|
46
|
+
|
47
|
+
Contributed by Luciano Sousa.
|
48
|
+
|
5
49
|
|
6
50
|
## Changes between Bunny 2.12.0 and 2.13.0 (Dec 25th, 2018)
|
7
51
|
|
@@ -19,13 +63,6 @@ connection could produce confusing log messages.
|
|
19
63
|
|
20
64
|
GitHub issue: [#569](https://github.com/ruby-amqp/bunny/issues/569)
|
21
65
|
|
22
|
-
### effin_utf8 Dependency Dropped
|
23
|
-
|
24
|
-
This library no longer supports Ruby 1.8 and thus
|
25
|
-
doesn't need to depend on the `effin_utf8` gem.
|
26
|
-
|
27
|
-
Contributed by Luciano Sousa.
|
28
|
-
|
29
66
|
|
30
67
|
## Changes between Bunny 2.11.0 and 2.12.0 (Sep 22nd, 2018)
|
31
68
|
|
@@ -127,7 +164,7 @@ a zero read timeout.
|
|
127
164
|
|
128
165
|
GitHub issue: [#551](https://github.com/ruby-amqp/bunny/pull/551).
|
129
166
|
|
130
|
-
Contributed by Carl
|
167
|
+
Contributed by Carl Hörberg.
|
131
168
|
|
132
169
|
|
133
170
|
### `verify_peer: false` Has the Expected Effect Again
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2009
|
1
|
+
Copyright (c) 2009–2019 Chris Duncan, Jakub Stastny aka botanicus,
|
2
2
|
Michael S. Klishin, Eric Lindvall, Stefan Kaes and contributors.
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining
|
data/README.md
CHANGED
@@ -71,6 +71,7 @@ a stable public API.
|
|
71
71
|
Change logs per release series:
|
72
72
|
|
73
73
|
* [master](https://github.com/ruby-amqp/bunny/blob/master/ChangeLog.md)
|
74
|
+
* [2.13.x](https://github.com/ruby-amqp/bunny/blob/2.13.x-stable/ChangeLog.md)
|
74
75
|
* [2.12.x](https://github.com/ruby-amqp/bunny/blob/2.12.x-stable/ChangeLog.md)
|
75
76
|
* [2.11.x](https://github.com/ruby-amqp/bunny/blob/2.11.x-stable/ChangeLog.md)
|
76
77
|
* [2.10.x](https://github.com/ruby-amqp/bunny/blob/2.10.x-stable/ChangeLog.md)
|
@@ -96,7 +97,7 @@ gem install bunny
|
|
96
97
|
To use Bunny in a project managed with Bundler:
|
97
98
|
|
98
99
|
``` ruby
|
99
|
-
gem "bunny", ">= 2.
|
100
|
+
gem "bunny", ">= 2.13.0"
|
100
101
|
```
|
101
102
|
|
102
103
|
|
data/Rakefile
CHANGED
@@ -44,3 +44,11 @@ RSpec::Core::RakeTask.new(:stress) do |t|
|
|
44
44
|
end
|
45
45
|
|
46
46
|
task :default => :integration
|
47
|
+
|
48
|
+
namespace :tls do
|
49
|
+
desc "Checks the certificates and keys in BUNNY_CERTIFICATE_DIR with openssl s_client"
|
50
|
+
task :s_client do
|
51
|
+
dir = ENV["BUNNY_CERTIFICATE_DIR"]
|
52
|
+
sh "openssl s_client -tls1_2 -connect 127.0.0.1:5671 -cert #{dir}/client_certificate.pem -key #{dir}/client_key.pem -CAfile #{dir}/ca_certificate.pem"
|
53
|
+
end
|
54
|
+
end
|
data/bunny.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.name = "bunny"
|
9
9
|
s.version = Bunny::VERSION.dup
|
10
10
|
s.homepage = "http://rubybunny.info"
|
11
|
-
s.summary = "
|
12
|
-
s.description = "Easy to use, feature complete Ruby client for RabbitMQ
|
11
|
+
s.summary = "Easy to use Ruby client for RabbitMQ"
|
12
|
+
s.description = "Easy to use, feature complete Ruby client for RabbitMQ"
|
13
13
|
s.license = "MIT"
|
14
14
|
s.required_ruby_version = Gem::Requirement.new(">= 2.2")
|
15
15
|
|
@@ -21,14 +21,14 @@ Gem::Specification.new do |s|
|
|
21
21
|
"Michael S. Klishin",
|
22
22
|
"Stefan Kaes"]
|
23
23
|
|
24
|
-
s.email = ["
|
24
|
+
s.email = ["mklishin@pivotal.io"]
|
25
25
|
|
26
26
|
# Dependencies
|
27
27
|
s.add_runtime_dependency 'amq-protocol', '~> 2.3', '>= 2.3.0'
|
28
28
|
|
29
29
|
# Files.
|
30
30
|
s.extra_rdoc_files = ["README.md"]
|
31
|
-
s.files = `git ls-files`.split("\n")
|
31
|
+
s.files = `git ls-files`.split("\n").reject { |f| f.match(%r{^bin/ci/}) }
|
32
32
|
s.test_files = `git ls-files -- spec/*`.split("\n")
|
33
33
|
s.require_paths = ["lib"]
|
34
34
|
end
|
data/docker-compose.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
version: '
|
1
|
+
version: '3.7'
|
2
2
|
services:
|
3
3
|
rabbitmq:
|
4
4
|
build: ./docker
|
@@ -8,7 +8,7 @@ services:
|
|
8
8
|
# see CONTRIBUTING.md
|
9
9
|
BUNNY_RABBITMQ_HOSTNAME: mercurio
|
10
10
|
# link to spec specific configuration
|
11
|
-
RABBITMQ_CONFIG_FILE: /spec/config/rabbitmq
|
11
|
+
RABBITMQ_CONFIG_FILE: /spec/config/rabbitmq.conf
|
12
12
|
RABBITMQ_ENABLED_PLUGINS_FILE: /spec/config/enabled_plugins
|
13
13
|
# send logs to stdout
|
14
14
|
RABBITMQ_LOGS: '-'
|
@@ -25,4 +25,4 @@ services:
|
|
25
25
|
- 8474:8474
|
26
26
|
- 11111:11111
|
27
27
|
depends_on:
|
28
|
-
- rabbitmq
|
28
|
+
- rabbitmq
|
data/docker/Dockerfile
CHANGED
@@ -1,13 +1,17 @@
|
|
1
|
-
FROM ubuntu:
|
1
|
+
FROM ubuntu:18.04
|
2
2
|
|
3
|
-
RUN apt-get
|
4
|
-
|
3
|
+
RUN apt-get update -y
|
4
|
+
RUN apt-get install -y gnupg2 wget
|
5
|
+
RUN wget -O - "https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc" | apt-key add -
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
COPY apt/sources.list.d/bintray.rabbitmq.list /etc/apt/sources.list.d/bintray.rabbitmq.list
|
8
|
+
COPY apt/preferences.d/erlang /etc/apt/preferences.d/erlang
|
8
9
|
|
9
|
-
RUN apt-get
|
10
|
-
|
10
|
+
RUN apt-get update -y
|
11
|
+
|
12
|
+
RUN apt-get upgrade -y && \
|
13
|
+
apt-get install -y erlang-asn1 erlang-crypto erlang-public-key erlang-ssl && \
|
14
|
+
apt-get install -y rabbitmq-server
|
11
15
|
|
12
16
|
COPY docker-entrypoint.sh /
|
13
17
|
|
data/docker/docker-entrypoint.sh
CHANGED
@@ -3,35 +3,24 @@ server=rabbitmq-server
|
|
3
3
|
ctl=rabbitmqctl
|
4
4
|
delay=5
|
5
5
|
|
6
|
-
echo
|
7
|
-
|
8
|
-
echo '[Configuration] Starting RabbitMQ in detached mode.'
|
9
|
-
|
6
|
+
echo 'Starting a RabbitMQ node'
|
10
7
|
$server -detached
|
11
8
|
|
12
|
-
echo "
|
9
|
+
echo "Waiting $delay seconds for RabbitMQ to start."
|
13
10
|
|
14
11
|
sleep $delay
|
15
12
|
|
16
|
-
echo '*** Creating users ***'
|
17
13
|
$ctl add_user bunny_gem bunny_password
|
18
14
|
$ctl add_user bunny_reader reader_password
|
19
15
|
|
20
|
-
echo '*** Creating virtual hosts ***'
|
21
16
|
$ctl add_vhost bunny_testbed
|
22
17
|
|
23
|
-
echo '*** Setting virtual host permissions ***'
|
24
18
|
$ctl set_permissions -p / guest '.*' '.*' '.*'
|
25
19
|
$ctl set_permissions -p bunny_testbed bunny_gem '.*' '.*' '.*'
|
26
20
|
$ctl set_permissions -p bunny_testbed guest '.*' '.*' '.*'
|
27
21
|
$ctl set_permissions -p bunny_testbed bunny_reader '^---$' '^---$' '.*'
|
28
22
|
|
29
|
-
$ctl
|
30
|
-
|
31
|
-
echo "[Configuration] Waiting $delay seconds for RabbitMQ to stop."
|
32
|
-
|
33
|
-
sleep $delay
|
34
|
-
|
35
|
-
echo 'Starting RabbitMQ in foreground (CTRL-C to exit)'
|
23
|
+
$ctl shutdown --timeout 10
|
36
24
|
|
25
|
+
echo 'Starting a RabbitMQ node in foreground (use Ctrl-C to stop)'
|
37
26
|
exec $server
|
@@ -0,0 +1,29 @@
|
|
1
|
+
listeners.tcp.1 = 0.0.0.0:5672
|
2
|
+
|
3
|
+
listeners.ssl.default = 5671
|
4
|
+
|
5
|
+
ssl_options.cacertfile = /spec/tls/ca_certificate.pem
|
6
|
+
ssl_options.certfile = /spec/tls/server_certificate.pem
|
7
|
+
ssl_options.keyfile = /spec/tls/server_key.pem
|
8
|
+
ssl_options.verify = verify_none
|
9
|
+
ssl_options.fail_if_no_peer_cert = false
|
10
|
+
|
11
|
+
ssl_options.honor_cipher_order = true
|
12
|
+
ssl_options.honor_ecc_order = true
|
13
|
+
ssl_options.client_renegotiation = false
|
14
|
+
ssl_options.secure_renegotiate = true
|
15
|
+
|
16
|
+
ssl_options.ciphers.1 = ECDHE-ECDSA-AES256-GCM-SHA384
|
17
|
+
ssl_options.ciphers.2 = ECDHE-RSA-AES256-GCM-SHA384
|
18
|
+
ssl_options.ciphers.3 = ECDH-ECDSA-AES256-GCM-SHA384
|
19
|
+
ssl_options.ciphers.4 = ECDH-RSA-AES256-GCM-SHA384
|
20
|
+
ssl_options.ciphers.5 = DHE-RSA-AES256-GCM-SHA384
|
21
|
+
ssl_options.ciphers.6 = DHE-DSS-AES256-GCM-SHA384
|
22
|
+
ssl_options.ciphers.7 = ECDHE-ECDSA-AES128-GCM-SHA256
|
23
|
+
ssl_options.ciphers.8 = ECDHE-RSA-AES128-GCM-SHA256
|
24
|
+
ssl_options.ciphers.9 = ECDH-ECDSA-AES128-GCM-SHA256
|
25
|
+
ssl_options.ciphers.10 = ECDH-RSA-AES128-GCM-SHA256
|
26
|
+
ssl_options.ciphers.11 = DHE-RSA-AES128-GCM-SHA256
|
27
|
+
ssl_options.ciphers.12 = DHE-DSS-AES128-GCM-SHA256
|
28
|
+
|
29
|
+
loopback_users = none
|
data/lib/bunny/session.rb
CHANGED
@@ -114,7 +114,8 @@ module Bunny
|
|
114
114
|
# @option connection_string_or_opts [Integer] :connection_timeout (30) Timeout in seconds for connecting to the server.
|
115
115
|
# @option connection_string_or_opts [Integer] :read_timeout (30) TCP socket read timeout in seconds. If heartbeats are disabled this will be ignored.
|
116
116
|
# @option connection_string_or_opts [Integer] :write_timeout (30) TCP socket write timeout in seconds.
|
117
|
-
# @option connection_string_or_opts [Proc] :hosts_shuffle_strategy
|
117
|
+
# @option connection_string_or_opts [Proc] :hosts_shuffle_strategy a callable that reorders a list of host strings, defaults to Array#shuffle
|
118
|
+
# @option connection_string_or_opts [Proc] :recovery_completed a callable that will be called when a network recovery is performed
|
118
119
|
# @option connection_string_or_opts [Logger] :logger The logger. If missing, one is created using :log_file and :log_level.
|
119
120
|
# @option connection_string_or_opts [IO, String] :log_file The file or path to use when creating a logger. Defaults to STDOUT.
|
120
121
|
# @option connection_string_or_opts [IO, String] :logfile DEPRECATED: use :log_file instead. The file or path to use when creating a logger. Defaults to STDOUT.
|
@@ -210,11 +211,13 @@ module Bunny
|
|
210
211
|
@address_index_mutex = @mutex_impl.new
|
211
212
|
|
212
213
|
@channels = Hash.new
|
214
|
+
@recovery_completed = opts[:recovery_completed]
|
213
215
|
|
214
216
|
@origin_thread = Thread.current
|
215
217
|
|
216
218
|
self.reset_continuations
|
217
219
|
self.initialize_transport
|
220
|
+
|
218
221
|
end
|
219
222
|
|
220
223
|
def validate_connection_options(options)
|
@@ -367,14 +370,16 @@ module Bunny
|
|
367
370
|
alias channel create_channel
|
368
371
|
|
369
372
|
# Closes the connection. This involves closing all of its channels.
|
370
|
-
def close
|
373
|
+
def close(await_response = true)
|
371
374
|
@status_mutex.synchronize { @status = :closing }
|
372
375
|
|
373
376
|
ignoring_io_errors do
|
374
377
|
if @transport.open?
|
378
|
+
@logger.debug "Transport is still open..."
|
375
379
|
close_all_channels
|
376
380
|
|
377
|
-
|
381
|
+
@logger.debug "Will close all channels...."
|
382
|
+
self.close_connection(await_response)
|
378
383
|
end
|
379
384
|
|
380
385
|
clean_up_on_shutdown
|
@@ -383,6 +388,8 @@ module Bunny
|
|
383
388
|
@status = :closed
|
384
389
|
@manually_closed = true
|
385
390
|
end
|
391
|
+
@logger.debug "Connection is closed"
|
392
|
+
true
|
386
393
|
end
|
387
394
|
alias stop close
|
388
395
|
|
@@ -567,11 +574,13 @@ module Bunny
|
|
567
574
|
end
|
568
575
|
|
569
576
|
# @private
|
570
|
-
def close_connection(
|
577
|
+
def close_connection(await_response = true)
|
571
578
|
if @transport.open?
|
579
|
+
@logger.debug "Transport is still open"
|
572
580
|
@transport.send_frame(AMQ::Protocol::Connection::Close.encode(200, "Goodbye", 0, 0))
|
573
581
|
|
574
|
-
if
|
582
|
+
if await_response
|
583
|
+
@logger.debug "Waiting for a connection.close-ok..."
|
575
584
|
@last_connection_close_ok = wait_on_continuations
|
576
585
|
end
|
577
586
|
end
|
@@ -742,6 +751,7 @@ module Bunny
|
|
742
751
|
end
|
743
752
|
|
744
753
|
recover_channels
|
754
|
+
notify_of_recovery_completion
|
745
755
|
end
|
746
756
|
rescue HostListDepleted
|
747
757
|
reset_address_index
|
@@ -755,8 +765,10 @@ module Bunny
|
|
755
765
|
retry
|
756
766
|
end
|
757
767
|
else
|
758
|
-
@logger.error "Ran out of recovery attempts (limit set to #{@max_recovery_attempts})"
|
759
|
-
|
768
|
+
@logger.error "Ran out of recovery attempts (limit set to #{@max_recovery_attempts}), giving up"
|
769
|
+
@transport.close
|
770
|
+
self.close(false)
|
771
|
+
@manually_closed = false
|
760
772
|
end
|
761
773
|
end
|
762
774
|
|
@@ -789,12 +801,20 @@ module Bunny
|
|
789
801
|
@channel_mutex.synchronize do
|
790
802
|
@channels.each do |n, ch|
|
791
803
|
ch.open
|
792
|
-
|
793
804
|
ch.recover_from_network_failure
|
794
805
|
end
|
795
806
|
end
|
796
807
|
end
|
797
808
|
|
809
|
+
def after_recovery_completed(&block)
|
810
|
+
@recovery_completed = block
|
811
|
+
end
|
812
|
+
|
813
|
+
# @private
|
814
|
+
def notify_of_recovery_completion
|
815
|
+
@recovery_completed.call if @recovery_completed
|
816
|
+
end
|
817
|
+
|
798
818
|
# @private
|
799
819
|
def instantiate_connection_level_exception(frame)
|
800
820
|
case frame
|
@@ -1200,7 +1220,7 @@ module Bunny
|
|
1200
1220
|
# If heartbeats are disabled, assume that TCP keepalives or a similar mechanism will be used
|
1201
1221
|
# and disable socket read timeouts. See ruby-amqp/bunny#551.
|
1202
1222
|
@transport.read_timeout = @heartbeat * 2.2
|
1203
|
-
@logger.debug { "Will use socket read timeout of #{@transport.read_timeout}" }
|
1223
|
+
@logger.debug { "Will use socket read timeout of #{@transport.read_timeout.to_i} seconds" }
|
1204
1224
|
|
1205
1225
|
# if there are existing channels we've just recovered from
|
1206
1226
|
# a network failure and need to fix the allocated set. See issue 205. MK.
|