bunny 2.17.0 → 2.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/lib/bunny/session.rb +22 -4
  4. data/lib/bunny/transport.rb +7 -6
  5. data/lib/bunny/version.rb +1 -1
  6. data/spec/higher_level_api/integration/basic_consume_spec.rb +14 -6
  7. data/spec/higher_level_api/integration/tls_connection_spec.rb +25 -32
  8. data/spec/issues/issue609_spec.rb +84 -0
  9. data/spec/lower_level_api/integration/basic_cancel_spec.rb +1 -1
  10. data/spec/lower_level_api/integration/basic_consume_spec.rb +8 -8
  11. metadata +28 -87
  12. data/.github/ISSUE_TEMPLATE.md +0 -18
  13. data/.gitignore +0 -28
  14. data/.rspec +0 -1
  15. data/.travis.yml +0 -33
  16. data/.yardopts +0 -8
  17. data/CONTRIBUTING.md +0 -132
  18. data/ChangeLog.md +0 -2129
  19. data/Gemfile +0 -55
  20. data/LICENSE +0 -21
  21. data/Rakefile +0 -54
  22. data/benchmarks/basic_publish/with_128K_messages.rb +0 -35
  23. data/benchmarks/basic_publish/with_1k_messages.rb +0 -35
  24. data/benchmarks/basic_publish/with_4K_messages.rb +0 -35
  25. data/benchmarks/basic_publish/with_64K_messages.rb +0 -35
  26. data/benchmarks/channel_open.rb +0 -28
  27. data/benchmarks/mutex_and_monitor.rb +0 -42
  28. data/benchmarks/queue_declare.rb +0 -29
  29. data/benchmarks/queue_declare_and_bind.rb +0 -29
  30. data/benchmarks/queue_declare_bind_and_delete.rb +0 -29
  31. data/benchmarks/synchronized_sorted_set.rb +0 -53
  32. data/benchmarks/write_vs_write_nonblock.rb +0 -49
  33. data/bunny.gemspec +0 -34
  34. data/docker-compose.yml +0 -28
  35. data/docker/Dockerfile +0 -24
  36. data/docker/apt/preferences.d/erlang +0 -3
  37. data/docker/apt/sources.list.d/bintray.rabbitmq.list +0 -2
  38. data/docker/docker-entrypoint.sh +0 -26
  39. data/docker/rabbitmq.conf +0 -29
  40. data/examples/connection/authentication_failure.rb +0 -16
  41. data/examples/connection/automatic_recovery_with_basic_get.rb +0 -40
  42. data/examples/connection/automatic_recovery_with_client_named_queues.rb +0 -36
  43. data/examples/connection/automatic_recovery_with_multiple_consumers.rb +0 -46
  44. data/examples/connection/automatic_recovery_with_republishing.rb +0 -109
  45. data/examples/connection/automatic_recovery_with_server_named_queues.rb +0 -35
  46. data/examples/connection/channel_level_exception.rb +0 -27
  47. data/examples/connection/disabled_automatic_recovery.rb +0 -34
  48. data/examples/connection/heartbeat.rb +0 -17
  49. data/examples/connection/manually_reconnecting_consumer.rb +0 -23
  50. data/examples/connection/manually_reconnecting_publisher.rb +0 -28
  51. data/examples/connection/unknown_host.rb +0 -16
  52. data/examples/consumers/high_and_low_priority.rb +0 -50
  53. data/examples/guides/exchanges/direct_exchange_routing.rb +0 -36
  54. data/examples/guides/exchanges/fanout_exchange_routing.rb +0 -28
  55. data/examples/guides/exchanges/headers_exchange_routing.rb +0 -31
  56. data/examples/guides/exchanges/mandatory_messages.rb +0 -30
  57. data/examples/guides/extensions/alternate_exchange.rb +0 -30
  58. data/examples/guides/extensions/basic_nack.rb +0 -33
  59. data/examples/guides/extensions/connection_blocked.rb +0 -35
  60. data/examples/guides/extensions/consumer_cancellation_notification.rb +0 -39
  61. data/examples/guides/extensions/dead_letter_exchange.rb +0 -32
  62. data/examples/guides/extensions/exchange_to_exchange_bindings.rb +0 -29
  63. data/examples/guides/extensions/per_message_ttl.rb +0 -36
  64. data/examples/guides/extensions/per_queue_message_ttl.rb +0 -36
  65. data/examples/guides/extensions/publisher_confirms.rb +0 -28
  66. data/examples/guides/extensions/queue_lease.rb +0 -26
  67. data/examples/guides/extensions/sender_selected_distribution.rb +0 -32
  68. data/examples/guides/getting_started/blabbr.rb +0 -27
  69. data/examples/guides/getting_started/hello_world.rb +0 -22
  70. data/examples/guides/getting_started/weathr.rb +0 -49
  71. data/examples/guides/queues/one_off_consumer.rb +0 -25
  72. data/examples/guides/queues/redeliveries.rb +0 -81
  73. data/profiling/basic_publish/with_4K_messages.rb +0 -33
  74. data/repl +0 -3
  75. data/spec/tls/generate-server-cert.sh +0 -8
  76. data/spec/tls/server-openssl.cnf +0 -10
  77. data/spec/tls/server.csr +0 -16
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: 2.17.0
4
+ version: 2.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Duncan
@@ -9,10 +9,10 @@ authors:
9
9
  - Jakub Stastny aka botanicus
10
10
  - Michael S. Klishin
11
11
  - Stefan Kaes
12
- autorequire:
12
+ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2020-09-11 00:00:00.000000000 Z
15
+ date: 2021-05-24 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: amq-protocol
@@ -34,6 +34,26 @@ dependencies:
34
34
  - - ">="
35
35
  - !ruby/object:Gem::Version
36
36
  version: 2.3.1
37
+ - !ruby/object:Gem::Dependency
38
+ name: sorted_set
39
+ requirement: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '1'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 1.0.2
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1'
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 1.0.2
37
57
  description: Easy to use, feature complete Ruby client for RabbitMQ 3.3 and later
38
58
  versions.
39
59
  email:
@@ -43,68 +63,7 @@ extensions: []
43
63
  extra_rdoc_files:
44
64
  - README.md
45
65
  files:
46
- - ".github/ISSUE_TEMPLATE.md"
47
- - ".gitignore"
48
- - ".rspec"
49
- - ".travis.yml"
50
- - ".yardopts"
51
- - CONTRIBUTING.md
52
- - ChangeLog.md
53
- - Gemfile
54
- - LICENSE
55
66
  - README.md
56
- - Rakefile
57
- - benchmarks/basic_publish/with_128K_messages.rb
58
- - benchmarks/basic_publish/with_1k_messages.rb
59
- - benchmarks/basic_publish/with_4K_messages.rb
60
- - benchmarks/basic_publish/with_64K_messages.rb
61
- - benchmarks/channel_open.rb
62
- - benchmarks/mutex_and_monitor.rb
63
- - benchmarks/queue_declare.rb
64
- - benchmarks/queue_declare_and_bind.rb
65
- - benchmarks/queue_declare_bind_and_delete.rb
66
- - benchmarks/synchronized_sorted_set.rb
67
- - benchmarks/write_vs_write_nonblock.rb
68
- - bunny.gemspec
69
- - docker-compose.yml
70
- - docker/Dockerfile
71
- - docker/apt/preferences.d/erlang
72
- - docker/apt/sources.list.d/bintray.rabbitmq.list
73
- - docker/docker-entrypoint.sh
74
- - docker/rabbitmq.conf
75
- - examples/connection/authentication_failure.rb
76
- - examples/connection/automatic_recovery_with_basic_get.rb
77
- - examples/connection/automatic_recovery_with_client_named_queues.rb
78
- - examples/connection/automatic_recovery_with_multiple_consumers.rb
79
- - examples/connection/automatic_recovery_with_republishing.rb
80
- - examples/connection/automatic_recovery_with_server_named_queues.rb
81
- - examples/connection/channel_level_exception.rb
82
- - examples/connection/disabled_automatic_recovery.rb
83
- - examples/connection/heartbeat.rb
84
- - examples/connection/manually_reconnecting_consumer.rb
85
- - examples/connection/manually_reconnecting_publisher.rb
86
- - examples/connection/unknown_host.rb
87
- - examples/consumers/high_and_low_priority.rb
88
- - examples/guides/exchanges/direct_exchange_routing.rb
89
- - examples/guides/exchanges/fanout_exchange_routing.rb
90
- - examples/guides/exchanges/headers_exchange_routing.rb
91
- - examples/guides/exchanges/mandatory_messages.rb
92
- - examples/guides/extensions/alternate_exchange.rb
93
- - examples/guides/extensions/basic_nack.rb
94
- - examples/guides/extensions/connection_blocked.rb
95
- - examples/guides/extensions/consumer_cancellation_notification.rb
96
- - examples/guides/extensions/dead_letter_exchange.rb
97
- - examples/guides/extensions/exchange_to_exchange_bindings.rb
98
- - examples/guides/extensions/per_message_ttl.rb
99
- - examples/guides/extensions/per_queue_message_ttl.rb
100
- - examples/guides/extensions/publisher_confirms.rb
101
- - examples/guides/extensions/queue_lease.rb
102
- - examples/guides/extensions/sender_selected_distribution.rb
103
- - examples/guides/getting_started/blabbr.rb
104
- - examples/guides/getting_started/hello_world.rb
105
- - examples/guides/getting_started/weathr.rb
106
- - examples/guides/queues/one_off_consumer.rb
107
- - examples/guides/queues/redeliveries.rb
108
67
  - lib/amq/protocol/extensions.rb
109
68
  - lib/bunny.rb
110
69
  - lib/bunny/authentication/credentials_encoder.rb
@@ -142,8 +101,6 @@ files:
142
101
  - lib/bunny/transport.rb
143
102
  - lib/bunny/version.rb
144
103
  - lib/bunny/versioned_delivery_tag.rb
145
- - profiling/basic_publish/with_4K_messages.rb
146
- - repl
147
104
  - spec/config/enabled_plugins
148
105
  - spec/config/rabbitmq.conf
149
106
  - spec/higher_level_api/integration/basic_ack_spec.rb
@@ -191,6 +148,7 @@ files:
191
148
  - spec/issues/issue224_spec.rb
192
149
  - spec/issues/issue465_spec.rb
193
150
  - spec/issues/issue549_spec.rb
151
+ - spec/issues/issue609_spec.rb
194
152
  - spec/issues/issue78_spec.rb
195
153
  - spec/issues/issue83_spec.rb
196
154
  - spec/issues/issue97_attachment.json
@@ -205,15 +163,6 @@ files:
205
163
  - spec/stress/concurrent_publishers_stress_spec.rb
206
164
  - spec/stress/connection_open_close_spec.rb
207
165
  - spec/stress/merry_go_round_spec.rb
208
- - spec/tls/ca_certificate.pem
209
- - spec/tls/ca_key.pem
210
- - spec/tls/client_certificate.pem
211
- - spec/tls/client_key.pem
212
- - spec/tls/generate-server-cert.sh
213
- - spec/tls/server-openssl.cnf
214
- - spec/tls/server.csr
215
- - spec/tls/server_certificate.pem
216
- - spec/tls/server_key.pem
217
166
  - spec/toxiproxy_helper.rb
218
167
  - spec/unit/bunny_spec.rb
219
168
  - spec/unit/concurrent/atomic_fixnum_spec.rb
@@ -226,7 +175,7 @@ homepage: http://rubybunny.info
226
175
  licenses:
227
176
  - MIT
228
177
  metadata: {}
229
- post_install_message:
178
+ post_install_message:
230
179
  rdoc_options: []
231
180
  require_paths:
232
181
  - lib
@@ -241,8 +190,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
241
190
  - !ruby/object:Gem::Version
242
191
  version: '0'
243
192
  requirements: []
244
- rubygems_version: 3.1.2
245
- signing_key:
193
+ rubygems_version: 3.1.4
194
+ signing_key:
246
195
  specification_version: 4
247
196
  summary: Popular easy to use Ruby client for RabbitMQ
248
197
  test_files:
@@ -293,6 +242,7 @@ test_files:
293
242
  - spec/issues/issue224_spec.rb
294
243
  - spec/issues/issue465_spec.rb
295
244
  - spec/issues/issue549_spec.rb
245
+ - spec/issues/issue609_spec.rb
296
246
  - spec/issues/issue78_spec.rb
297
247
  - spec/issues/issue83_spec.rb
298
248
  - spec/issues/issue97_attachment.json
@@ -307,15 +257,6 @@ test_files:
307
257
  - spec/stress/concurrent_publishers_stress_spec.rb
308
258
  - spec/stress/connection_open_close_spec.rb
309
259
  - spec/stress/merry_go_round_spec.rb
310
- - spec/tls/ca_certificate.pem
311
- - spec/tls/ca_key.pem
312
- - spec/tls/client_certificate.pem
313
- - spec/tls/client_key.pem
314
- - spec/tls/generate-server-cert.sh
315
- - spec/tls/server-openssl.cnf
316
- - spec/tls/server.csr
317
- - spec/tls/server_certificate.pem
318
- - spec/tls/server_key.pem
319
260
  - spec/toxiproxy_helper.rb
320
261
  - spec/unit/bunny_spec.rb
321
262
  - spec/unit/concurrent/atomic_fixnum_spec.rb
@@ -1,18 +0,0 @@
1
- ## Does This Really Belong to GitHub issues?
2
-
3
- If you find a bug you understand well, poor default, incorrect or unclear piece of documentation,
4
- or missing feature, please [file an
5
- issue](http://github.com/ruby-amqp/bunny/issues) on GitHub.
6
-
7
- Please use [Bunny's mailing list](http://groups.google.com/group/ruby-amqp) for questions,
8
- investigations, and discussions. GitHub issues should be used for specific, well understood, actionable
9
- maintainers and contributors can work on.
10
-
11
- When filing an issue, please specify
12
-
13
- * Which Bunny and RabbitMQ versions are used
14
- * Recent RabbitMQ log file contents
15
- * Full exception stack traces
16
- * Steps to reproduce or a failing test case
17
-
18
- This would greatly help the maintainers help you.
data/.gitignore DELETED
@@ -1,28 +0,0 @@
1
- .DS_Store
2
- .*.swp
3
- *.class
4
- *.rbc
5
- *.gem
6
- /doc/
7
- .yardoc
8
- .rvmrc
9
- Gemfile.lock
10
- .rbx/*
11
- .tags
12
- .tags_sorted_by_file
13
- .Apple*
14
- /bin/*
15
- .bundle/*
16
- vendor/*
17
- playground/*
18
- *.org
19
- repl-*
20
- debug/*
21
- *.dump
22
- deploy.docs.sh
23
- .ruby-version
24
- .idea
25
- *.srl
26
- spec/tls/*.pem
27
- spec/tls/*.pem~
28
- spec/tls/*.p12
data/.rspec DELETED
@@ -1 +0,0 @@
1
- -c -fp
data/.travis.yml DELETED
@@ -1,33 +0,0 @@
1
- dist: bionic
2
- language: ruby
3
- bundler_args: --without development
4
- cache: bundler
5
- before_install:
6
- - gem install bundler
7
- before_script:
8
- - "./bin/ci/install_on_debian.sh"
9
- - until sudo lsof -i:5672; do echo "Waiting for RabbitMQ to start..."; sleep 1; done
10
- - "./bin/ci/before_build.sh"
11
- script: "bundle exec rake integration_without_recovery"
12
- rvm:
13
- - ruby-head
14
- - "2.7.1"
15
- - "2.6.6"
16
- - "2.5.8"
17
- - "2.4.10"
18
- - "2.3.8"
19
- notifications:
20
- email: michael@rabbitmq.com
21
- services:
22
- - rabbitmq
23
- branches:
24
- only:
25
- - master
26
- - 2.14.x-stable
27
- - 2.13.x-stable
28
- env:
29
- - CI=true
30
- matrix:
31
- allow_failures:
32
- rvm:
33
- - ruby-head
data/.yardopts DELETED
@@ -1,8 +0,0 @@
1
- --no-private
2
- --protected
3
- --markup="markdown" lib/**/*.rb
4
- --main README.md
5
- --hide-tag todo
6
- -
7
- LICENSE
8
- ChangeLog.md
data/CONTRIBUTING.md DELETED
@@ -1,132 +0,0 @@
1
- ## Overview
2
-
3
- This project **does not** use GitHub issues for questions, investigations, discussions, and so on.
4
- Issues are appropriate for something specific enough for a maintainer or contributor to work on:
5
-
6
- * There should be enough information to reproduce the behavior observed in a reasonable amount of time
7
- * It should be reasonably clear why the behavior should be changed and why this cannot or should not be addressed
8
- in application code, a separate library and so on
9
-
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
- of being closed.
12
-
13
- ## Submitting a Pull Request
14
-
15
- Please read the sections below to get an idea about how to run Bunny test suites first. Successfully
16
- running all tests, at least with `CI` environment variable exported to `true`, is an important
17
- first step for any contributor.
18
-
19
- Once you have a passing test suite, create a branch and make your changes on it.
20
- When you are done with your changes and all
21
- tests pass, write a [good, detailed commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) submit a pull request on GitHub.
22
-
23
- ## Pre-requisites
24
-
25
- The project uses Bundler for dependency management and requires RabbitMQ `3.5+` to be running
26
- locally with the `rabbitmq-management` and `rabbitmq_consistent_hash_exchange` plugins enabled.
27
-
28
- ### Running the Specs
29
-
30
- The specs require RabbitMQ to be running locally with a specific set of virtual hosts
31
- and users. RabbitMQ can be provisioned and started any way that's convenient to you
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.7.10`).
34
-
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.
37
-
38
- ### Using a locally installed RabbitMQ node
39
-
40
- It is possible to start a local RabbitMQ node from the repository root. It is not necessarily
41
- optimal but can be a good starting point but is a useful example:
42
-
43
- ```
44
- RABBITMQ_NODENAME=bunny RABBITMQ_CONFIG_FILE=./spec/config/rabbitmq.conf RABBITMQ_ENABLED_PLUGINS_FILE=./spec/config/enabled_plugins rabbitmq-server
45
- ```
46
-
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.
55
-
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:
57
-
58
- ```
59
- BUNNY_CERTIFICATE_DIR="/path/to/tls-gen/basic/result" BUNNY_RABBITMQ_HOSTNAME="mayflower" bundle exec rspec
60
-
61
- ```
62
-
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:
71
-
72
- ```
73
- RABBITMQ_NODENAME=bunny ./bin/ci/before_build
74
- ```
75
-
76
- The script uses `rabbitmqctl` and `rabbitmq-plugins`
77
- to set up RabbitMQ in a way that Bunny test suites expect. Two environment variables,
78
- `RABBITMQCTL` and `RABBITMQ_PLUGINS`, are available to control what `rabbitmqctl` and
79
- `rabbitmq-plugins` commands will be used. By default they are taken from `PATH`
80
- and prefixed with `sudo`.
81
-
82
- And then run the core integration suite:
83
-
84
- ```
85
- RABBITMQ_NODENAME=bunny CI=true rspec
86
- ```
87
-
88
- #### Running a RabbitMQ server in a Docker container
89
-
90
- First off you have to [install Docker Compose](https://docker.github.io/compose/install/) (and by proxy Docker).
91
- Version >= 1.6.0+ is required for compose version 2 syntax.
92
-
93
- After those have been installed (and the `docker-compose` command is available on your command line path), run
94
-
95
- ```
96
- docker-compose build && docker-compose run --service-ports rabbitmq
97
- ```
98
-
99
- The first time you do this, it will take some time, since it has to download everything it needs
100
- to build the Docker image.
101
-
102
- The RabbitMQ server will run in the foreground in the terminal where you started it. You can stop
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.
114
-
115
- ### Running Test Suites
116
-
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
119
- is not required as the setup is baked in.
120
-
121
- Make sure you have those two installed and then run integration tests:
122
-
123
- bundle install
124
- rake integration
125
-
126
- It is possible to run all tests:
127
-
128
- bundle exec rspec
129
-
130
- It is possible to run only integration and regression tests but exclude unit and stress tests:
131
-
132
- CI=true bundle exec rspec spec/higher_level_api/ spec/lower_level_api spec/issues spec/higher_level_api/integration/connection_recovery_spec.rb
data/ChangeLog.md DELETED
@@ -1,2129 +0,0 @@
1
- ## Changes between Bunny 2.17.x and 2.18.0 (in development)
2
-
3
- No changes yet.
4
-
5
-
6
- ## Changes between Bunny 2.16.x and 2.17.0 (Sep 11th, 2020)
7
-
8
- ### Easier to Specify a Client-Propvided Connection Name
9
-
10
- It is now easier to provide a client-provided (custom) connection
11
- name that will be displayed in the RabbitMQ management UI and mentioned in
12
- [server logs](https://www.rabbitmq.com/logging.html).
13
-
14
- Instead of
15
-
16
- ``` ruby
17
- conn = Bunny.new(client_properties: {connection_name: 'app ABC #{rand}'})
18
- conn.start
19
- ```
20
-
21
- a new top-level connection option now can be used:
22
-
23
- ``` ruby
24
- conn = Bunny.new(connection_name: 'app ABC #{rand}')
25
- conn.start
26
- ```
27
-
28
- Contributed by @brerx.
29
-
30
- GitHub issue: [ruby-amqp/bunny#600](https://github.com/ruby-amqp/bunny/pull/600)
31
-
32
-
33
- ## Changes between Bunny 2.15.0 and 2.16.0 (Aug 14th, 2020)
34
-
35
- ### Asynchronous Exception Delegate
36
-
37
- Bunny now can delete asynchronous connection (`Bunny::Session`) exception to an arbitrary
38
- delegate object. Use the `:session_error_handler` connection setting to pass it.
39
- The value defaults to `Thread.current`.
40
-
41
- Contributed by @bbascarevic.
42
-
43
- GitHub issue: [ruby-amqp/bunny#597](https://github.com/ruby-amqp/bunny/issues/597)
44
-
45
-
46
- ## Changes between Bunny 2.14.0 and 2.15.0 (Apr 8th, 2020)
47
-
48
- ### More Defensive Thread Join Operations
49
-
50
- Bunny is now more defensive around thread join operations which it performs
51
- when stopping its consumer work pool.
52
-
53
- `Thread#join` can cause an unhandled exception to be re-raised at
54
- a very surprising moment. This behavior can also be affected by 3rd party
55
- libraries, e.g. those that do connection pooling. While Bunny cannot
56
- fully avoid every possible surprising failure, it now avoids at least
57
- one such problematic interaction triggered by a custom [interrupt handler](https://ruby-doc.org/core-2.5.1/Thread.html#method-c-handle_interrupt)
58
- in a 3rd party library.
59
-
60
- GitHub issue: [#589](https://github.com/ruby-amqp/bunny/issues/589)
61
-
62
- Contributed by @fuegas.
63
-
64
- ### Dependency Updates
65
-
66
- `amq-protocol` dependency has been bumped to `2.3.1` to support `connection.update-secret`
67
- protocol extension.
68
-
69
- ### Gem Installation Fixed on Windows
70
-
71
- `bin/ci`, a directory with symlinks, is no longer included into the gem.
72
-
73
- Contributed by Jack Xiaosong Xu.
74
-
75
- ### Lazy Peer Certificate Chain Information Logging
76
-
77
- Peer certificate chain information is now logged lazily, which prevents
78
- an obscure exception originating ASN.1 parser and makes the logging
79
- code evaluate only when it is really necessary.
80
-
81
- GitHub issue: [#578](https://github.com/ruby-amqp/bunny/pull/578)
82
-
83
- Contributed by Garrett Thornburg.
84
-
85
-
86
- ## Changes between Bunny 2.13.0 and 2.14.0 (Feb 20th, 2019)
87
-
88
- ### Improved Peer Verification Failure Logging
89
-
90
- When [peer verification](https://www.rabbitmq.com/ssl.html#peer-verification) fails, the connection will now log
91
- some relevant peer certificate chain details. If Bunny
92
- log level is set to `debug`, the same information will be logged
93
- unconditionally.
94
-
95
- ### Closing Connections without Waiting for Response
96
-
97
- `Bunny::Session#close` now accepts a parameter that controls whether
98
- it waits for a `connection.close-ok` frame. Not waiting is useful
99
- when it is known for a fact that the node might not respond
100
- (it might be shutting down, connection is known to be interrupted
101
- or unrecoverable and so on) or waiting is irrelevant to the caller.
102
-
103
- ### Successful Connection Recovery Notification
104
-
105
- `Bunny::Session#after_recovery_completed` (accepts a block)
106
- and a new connection option, `:recovery_completed` (a callable object)
107
- can be used to react to successful connection and topology recovery.
108
-
109
- GitHub issue: [#573](https://github.com/ruby-amqp/bunny/pull/573).
110
-
111
- Contributed by Ionut Popa.
112
-
113
- ### effin_utf8 Dependency Dropped
114
-
115
- This library no longer supports Ruby 1.8 and thus
116
- doesn't need to depend on the `effin_utf8` gem.
117
-
118
- Contributed by Luciano Sousa.
119
-
120
-
121
- ## Changes between Bunny 2.12.0 and 2.13.0 (Dec 25th, 2018)
122
-
123
- ### More Defensive `Bunny::Channel` Method(s)
124
-
125
- `Bunny::Channel#queue` will now throw an `ArgumentError` if a `nil`
126
- is passed for queue name.
127
-
128
- GitHub issue: [#570](https://github.com/ruby-amqp/bunny/issues/570)
129
-
130
- ### Correct Logging of Recovery Attempts Left
131
-
132
- During connection recovery, if `recover_attempts` is not set (is `nil`)
133
- connection could produce confusing log messages.
134
-
135
- GitHub issue: [#569](https://github.com/ruby-amqp/bunny/issues/569)
136
-
137
-
138
- ## Changes between Bunny 2.11.0 and 2.12.0 (Sep 22nd, 2018)
139
-
140
- ### More Defensive Treatment of `queue.declare-ok` Responses
141
-
142
- Responses for `queue.declare` are now checked against a memoized
143
- queue name (but only if the queue is not server-named). This helps
144
- avoids scenarios with overlapping/concurrent requests due to high
145
- network latency as demonstrated in [#558](https://github.com/ruby-amqp/bunny/issues/558).
146
-
147
- "Mismatched" responses will be ignored: Bunny channel API would throw
148
- an exception for such declarations and there would be no way to "return to"
149
- even if a matching response arrived and was matched with one of the pending
150
- requests in a reasonable period of time.
151
-
152
- As part of this work a new Toxiproxy-based test suite was introduced
153
- to Bunny.
154
-
155
- GitHub issue: [#558](https://github.com/ruby-amqp/bunny/issues/558)
156
-
157
- Reproduction steps contributed by Brian Morton and Scott Bonebraker.
158
-
159
- ### I/O Exceptions from Heartbeat Sender are Now Silent
160
-
161
- Heartbeat sender's purpose is to notify the peer, not so much
162
- to detect local connectivity failures; those will be detected
163
- by the I/O loop and transport.
164
-
165
- For single threaded connection users that prefer to roll their own
166
- recovery strategies getting exceptions from the heartbeat sender
167
- was counterproductive and painful to deal with.
168
-
169
- As part of this work a new Toxiproxy-based test suite was introduced
170
- to Bunny.
171
-
172
- GitHub issue: [#559](https://github.com/ruby-amqp/bunny/issues/559)
173
-
174
- Contributed by Scott Bonebraker.
175
-
176
- ### Correct Connection State on Connections that Experienced Missed Heartbeat
177
-
178
- Connections that experienced connection closure did not always correctly transition to the closed state.
179
- `Bunny::ConnectionClosedError` will now be thrown when an operation is attempted on such
180
- connections.
181
-
182
- GitHub issue: [#561](https://github.com/ruby-amqp/bunny/issues/561)
183
-
184
- Contributed by Scott Bonebraker.
185
-
186
- ### Connection Recovery Will Fail When Max Retry Attempt Limit is Exceeded
187
-
188
- GitHub issue: [#549](https://github.com/ruby-amqp/bunny/issues/549)
189
-
190
- Contributed by Arlandis Word.
191
-
192
- ### Squashed Warnings
193
-
194
- Many warnings have been eliminated.
195
-
196
- GitHub issue: [#563](https://github.com/ruby-amqp/bunny/issues/563)
197
-
198
- Contributed by @dacto.
199
-
200
-
201
- ### API Reference Corrections
202
-
203
- GitHub issue: [#557](https://github.com/ruby-amqp/bunny/pull/557)
204
-
205
- Contributed by Bruno Costa.
206
-
207
-
208
- ## Changes between Bunny 2.10.0 and 2.11.0 (Jun 21st, 2018)
209
-
210
- ### More Reliable System-wide Trusted Certificate Directory Detection
211
-
212
- Bunny no longer tries to compile a list of trusted CA certificates on its own.
213
- Instead it uses an OpenSSL API method that makes OpenSSL set the path(s),
214
- which should cover more platforms and be forward- and backward-compatible.
215
-
216
- GitHub issue: [#555](https://github.com/ruby-amqp/bunny/issues/555).
217
-
218
- Contributed by Ana María Martínez Gómez.
219
-
220
-
221
-
222
- ## Changes between Bunny 2.9.0 and 2.10.0 (Jun 5th, 2018)
223
-
224
- `2.10.0` is a maintenance release that introduces a couple of
225
- **minor potentially breaking changes**.
226
-
227
-
228
- ### Disabling Heartbeats Also Disables TCP Socket Read Timeouts
229
-
230
- Disabling heartbeats will now disable TCP socket read timeouts.
231
-
232
- They go hand in hand and users who prefer TCP keepalives via
233
- kernel configuration previously had to also explicitly configure
234
- a zero read timeout.
235
-
236
- GitHub issue: [#551](https://github.com/ruby-amqp/bunny/pull/551).
237
-
238
- Contributed by Carl Hörberg.
239
-
240
-
241
- ### `verify_peer: false` Has the Expected Effect Again
242
-
243
- Make sure `verify_peer: false` has the expected effect again.
244
-
245
- Default value of connection's `:verify_peer` option to `true` only when
246
- all of `:verify_ssl`, `:verify_peer`, and `:verify` are `nil`.
247
-
248
- GitHub issue: [#541](https://github.com/ruby-amqp/bunny/issues/541).
249
-
250
- Contributed by Howard Ding.
251
-
252
-
253
- ### Maximum Number of Channels Limited to 2K by Default
254
-
255
- Default maximum number of channels is limited to 2047 to reduce the probability
256
- of severe channel leaks. See [rabbitmq/rabbitmq-server#1593](https://github.com/rabbitmq/rabbitmq-server/issues/1593) for details.
257
-
258
- Applications that want to use more channels per connection can still configure a higher value
259
- using the `channel_max` setting (for both Bunny and RabbitMQ server).
260
-
261
- GitHub issue: [#553](https://github.com/ruby-amqp/bunny/pull/553).
262
-
263
-
264
-
265
- ### Squashed Some Warnings
266
-
267
- GitHub issue: [#552](https://github.com/ruby-amqp/bunny/pull/552).
268
-
269
- Contributed by @utilum.
270
-
271
-
272
-
273
- ### Disabling Heartbeats Disables TCP Socket Read Timeouts
274
-
275
- Disabling heartbeats will also disable TCP socket read timeouts,
276
- since the two are effectively interconnected. In this case a mechanism
277
- such as [TCP keepalives](http://www.rabbitmq.com/heartbeats.html#tcp-keepalives) is assumed to be used.
278
-
279
- See [RabbitMQ heartbeats guide](http://www.rabbitmq.com/heartbeats.html) for a more
280
- detailed overview of the options.
281
-
282
- GH issue: [#519](https://github.com/ruby-amqp/bunny/issues/519).
283
-
284
- Contributed by Carl Hörberg.
285
-
286
-
287
- ## Changes between Bunny 2.8.0 and 2.9.0 (Jan 8th, 2018)
288
-
289
- ### Ruby 2.2 Requirement
290
-
291
- Bunny now requires Ruby 2.2.
292
-
293
-
294
- ### Connection Recovery Now Retries on Timeouts
295
-
296
- Connection recovery now will retry on TCP connection timeouts.
297
-
298
- GitHub issue: [#537](https://github.com/ruby-amqp/bunny/pull/537).
299
-
300
-
301
- ### More URI Query Parameters
302
-
303
- Bunny now supports more URI query parameters plus aliases
304
- that are identical to those of the server.
305
-
306
- Contributed by Andrew Babichev.
307
-
308
- GitHub issue: [#534](https://github.com/ruby-amqp/bunny/pull/534)
309
-
310
-
311
-
312
- ## Changes between Bunny 2.7.0 and 2.8.0 (Dec 18th, 2018)
313
-
314
- This release has **minor breaking public API changes**.
315
-
316
- ### `Bunny::Channel#close` on a Closed Channel Now Raises a Sensible Exception
317
-
318
- `Bunny::Channel#close` on an already closed channel will now raise a sensible exception.
319
- If the channel was closed due to a channel-level protocol exception, that exception will
320
- be mentioned.
321
-
322
- GitHub issue: [#528](https://github.com/ruby-amqp/bunny/issues/528), see [9df7cb](https://github.com/ruby-amqp/bunny/commit/9df7cb04d9ff12b1af62a11e239fd81e5472c872) for
323
- details.
324
-
325
- ### JRuby 9K Compatibility
326
-
327
- A JRuby 9K compatibility issue was corrected by Marian Posăceanu.
328
- Note that JRuby users are recommended to use [March Hare](http://rubymarchhare.info/), a JRuby-oriented client, instead
329
- of Bunny.
330
-
331
- GitHub issue: [#529](https://github.com/ruby-amqp/bunny/pull/529)
332
-
333
- ### Connection Exceptions are Logged as Warning with Automatic Recovery
334
-
335
- When automatic recovery is enabled, connection errors are now logged as warnings
336
- and not errors.
337
-
338
- Contributed by Merten Falk.
339
-
340
- GitHub issue: [#531](https://github.com/ruby-amqp/bunny/pull/531)
341
-
342
- ### Server Heartbeat Value as a String
343
-
344
- It is now possible to specify a server-defined heartbeat value as a string (`"server"`), not just
345
- a symbol. This makes it easier to load settings from YAML files.
346
-
347
- Contributed by Tyrone Wilson.
348
-
349
- GitHub issue: [#524](https://github.com/ruby-amqp/bunny/pull/524)
350
-
351
-
352
- ## Changes between Bunny 2.7.0 and 2.7.1 (Sep 25th, 2017)
353
-
354
- ### Sensible Socket Read Timeouts When RabbitMQ is Configured to Disabled Heartbeats
355
-
356
- Bunny now correctly handles scenarios where server is configured
357
- to disable heartbeats (which is a terrible idea, don't do it!)
358
-
359
- GitHub issue: [#519](https://github.com/ruby-amqp/bunny/issues/519).
360
-
361
- ### Bunny::Channel#basic_get Usability
362
-
363
- `Bunny::Channel#basic_get` invoked with a non-existent queue now
364
- throws a channel exception instead of a generic operation timeout.
365
-
366
- GitHub issue: [#518](https://github.com/ruby-amqp/bunny/issues/518).
367
-
368
- ### Spec Suite Improvements
369
-
370
- `BUNNY_CERTIFICATE_DIR` environment variable now can be used
371
- to override local CA and client certificate/key pair directory.
372
- The directory is expected to be the result directory generated
373
- by the basic [tls-gen](http://github.com/michaelklishin/tls-gen) profile.
374
-
375
- TLSv1.0 is no longer used in tests because it's being disabled by default
376
- by more and more installations as it has known vulnerabilities
377
- and is no longer considered to be acceptable by several compliance
378
- standards (e.g. PCI DSS).
379
-
380
- ### Improved Synchronisation for channel.close Handlers
381
-
382
- `channel.close` handler will now acquire a lock . This avoids concurrency
383
- hazards in some rare scenarios when a channel is closed due a protocol
384
- exception by the server and concurrently opened by user code
385
- at the same time.
386
-
387
- ### More Meaningful Error Messages in Bunny::Session#create_channel
388
-
389
- Sometimes users attempt to open a channel on a connection that
390
- isn't connected yet because `Bunny::Session#start` was never invoked.
391
-
392
- `Bunny::Session#create_channel` will now provide a more sensible exception message
393
- in those cases.
394
-
395
-
396
- ## Changes between Bunny 2.6.0 and 2.7.0 (May 11th, 2017)
397
-
398
- ### amq-protocol Update
399
-
400
- Minimum `amq-protocol` version is now [`2.2.0`](https://github.com/ruby-amqp/amq-protocol/blob/master/ChangeLog.md#changes-between-210-and-220-may-11th-2017) which includes
401
- a change in [how timestamps are encoded](https://github.com/ruby-amqp/amq-protocol/issues/64).
402
-
403
-
404
- ### `Bunny::ContinuationQueue#poll` Less Prone to Race Conditions
405
-
406
- `Bunny::ContinuationQueue#poll` was reworked with feedback from Joseph Wong.
407
-
408
- GitHub issue: [#462](https://github.com/ruby-amqp/bunny/issues/462)
409
-
410
-
411
- ### Recovery Attempt Counting Strategy Changed
412
-
413
- Previous behehavior is not unreasonable but is not what many users and
414
- even RabbitMQ team members come to expect. Therefore it can be
415
- considered a bug.
416
-
417
- Previously a reconnection counter was preserved between successful
418
- recoveries. This made the integration test that uses server-sent
419
- connection.close possible.
420
-
421
- With this change, the counter is reset after successful reconnection
422
- but there's an option to go back to the original behavior. We also do
423
- a hell of a lot more logging.
424
-
425
- GitHub issue: [#408](https://github.com/ruby-amqp/bunny/issues/408)
426
-
427
-
428
- ### Absolute Windows File Paths are No Longer treated as Inline Certs
429
-
430
- Contributed by Jared Smartt.
431
-
432
- GitHub issue: [#492](https://github.com/ruby-amqp/bunny/issues/492).
433
-
434
-
435
- ### Opening a Channel on an Intentionally Closed Connection Immediately Raises an Exception
436
-
437
- Contributed by Alessandro Verlato.
438
-
439
- GitHub issue: [#465](https://github.com/ruby-amqp/bunny/issues/465)
440
-
441
-
442
- ### Bunny::ConsumerWorkPool#shutdown Terminates Early When It's Safe to Do So
443
-
444
- `Bunny::ConsumerWorkPool#shutdown(true)` waited for consumer shutdown
445
- even if the pool wasn't active (there were no consumers on its
446
- channel).
447
-
448
- GitHub issue: [#438](https://github.com/ruby-amqp/bunny/issues/438).
449
-
450
-
451
- ### Retry on new Ruby 2.1+ variations of `EAGAIN`, `EWOULDBLOCK`
452
-
453
- GitHub issue: [#456](https://github.com/ruby-amqp/bunny/issues/456)
454
-
455
-
456
- ### Do Not Modify Host Arrays
457
-
458
- Bunny now can work with frozen host arrays.
459
-
460
- GitHub issue: [#446](https://github.com/ruby-amqp/bunny/issues/446)
461
-
462
-
463
-
464
- ## Changes between Bunny 2.5.0 and 2.6.0 (October 15th, 2016)
465
-
466
- ### Graceful Shutdown of Consumers
467
-
468
- Consumer work pool will now allow for a grace period before stopping
469
- pool threads so that delivery processing in progress can have a chance to finish.
470
-
471
- GitHub issue: [#437](https://github.com/ruby-amqp/bunny/pull/437)
472
-
473
- Contributed by Stefan Sedich.
474
-
475
- ### `Bunny::Channel#wait_for_confirms` Now Throws When Used on a Closed Channel
476
-
477
- GitHub issue: [#428](https://github.com/ruby-amqp/bunny/pull/428)
478
-
479
- Contributed by Dimitar Dimitrov.
480
-
481
- ### Race Condition Eliminated in `Bunny::Channel#wait_for_confirms`
482
-
483
- GitHub issue: [#424](https://github.com/ruby-amqp/bunny/issues/424)
484
-
485
- Contributed by Dimitar Dimitrov.
486
-
487
- ### More Defensive Consumer Work Pool
488
-
489
- `Bunny::ConsumerWorkPool#join` and `Bunny::ConsumerWorkPool#pause`
490
- no longer fails with a `NoMethodError` on nil when executed
491
- on a work pool that doesn't have active threads (consumers).
492
-
493
- This change is largely cosmetic and won't affect the majority
494
- of of projects in any way.
495
-
496
-
497
- ## Changes between Bunny 2.4.0 and 2.5.0 (July 20th, 2016)
498
-
499
- ### Exchange Bindings are Now Correctly Recovered
500
-
501
- GitHub issue: [#410](https://github.com/ruby-amqp/bunny/issues/410)
502
-
503
- Contributed by Andrew Bruce.
504
-
505
-
506
- ### `Bunny::Channel#wait_for_confirms` Awaits While There're Outstanding Unconfirmed Messages
507
-
508
- GitHub issue: [#424](https://github.com/ruby-amqp/bunny/issues/424)
509
-
510
- Contributed by Dimitar Dimitrov.
511
-
512
-
513
- ### Queue Recovery Respects the `:no_declare` Option
514
-
515
- Queue recovery now respects the `:no_declare` option.
516
-
517
-
518
- ### `Bunny::Channel#wait_for_confirms` Throws Early
519
-
520
- `Bunny::Channel#wait_for_confirms` now throws an exception
521
- early when invoked on a closed channel.
522
-
523
- GitHub issue: [#428](https://github.com/ruby-amqp/bunny/pull/428).
524
-
525
- Contributed by Dimitar Dimitrov.
526
-
527
-
528
-
529
- ## Changes between Bunny 2.3.0 and 2.4.0 (June 11th, 2016)
530
-
531
- **This release includes minor breaking API changes**.
532
-
533
- ### Unconfirmed Delivery Tag Set Reset on Network Recovery
534
-
535
- Channels will now reset their unconfirmed delivery tag set after
536
- recovery.
537
-
538
- GitHub issue: [#406](https://github.com/ruby-amqp/bunny/pull/406)
539
-
540
- Contributed by Bill Ruddock.
541
-
542
- ### Support (Quoted) IPv6 Addresses in Address Lists
543
-
544
- GitHub issue: [#383](https://github.com/ruby-amqp/bunny/issues/383).
545
-
546
- Contributed by Jeremy Heiler.
547
-
548
- ### Transport#read_fully Doesn't Try to Recover
549
-
550
- Since transport is replaced by a recovering connection
551
- anyway, and this produces confusing errors up the stack.
552
-
553
- GitHub issue: [#359](https://github.com/ruby-amqp/bunny/issues/359)
554
-
555
- Contributed by Donal McBreen.
556
-
557
- ### Client-Provided Session `:properties` Merged with Defaults
558
-
559
- Client-Provided Session `:properties` will now be merged with defaults
560
- instead of replacing them. This makes it much more convenient to
561
- override a single key.
562
-
563
- ### More Predictable RABBITMQ_URL Handling
564
-
565
- **This is a breaking API change**.
566
-
567
- `RABBITMQ_URL` no longer will be used if any other
568
- connection options are provided. This makes it possible
569
- to use `RABBITMQ_URL` for some connections and options
570
- for others in a single OS process.
571
-
572
- GitHub issue: [#403](https://github.com/ruby-amqp/bunny/pull/403)
573
-
574
- Contributed by Jimmy Petersen.
575
-
576
-
577
- ## Changes between Bunny 2.2.0 and 2.3.0 (Feb 26th, 2016)
578
-
579
- ### Thread#abort_on_exception Setting for Consumer Work Pool Threads
580
-
581
- `Bunny::Session#create_channel` now supports a 3rd argument that,
582
- when set to `true`, makes consumer work pool threads to have
583
- `Thread#abort_on_exception` set on them.
584
-
585
- GH issue: [#382](https://github.com/ruby-amqp/bunny/pull/382)
586
-
587
- Contributed by Seamus Abshere.
588
-
589
- ### Explicit Transport Closure on Recovery
590
-
591
- Bunny now will explicitly close previosly used transport before starting
592
- connection recovery.
593
-
594
- GitHub issue: [#377](https://github.com/ruby-amqp/bunny/pull/377).
595
-
596
- Contributed by bkanhoopla.
597
-
598
- ### No TLS Socket Double-init
599
-
600
- Makes sure that TLS sockets are not double-initialized.
601
-
602
- GH issue: [#345](https://github.com/ruby-amqp/bunny/issues/345).
603
-
604
- Contributed by Carl Hörberg.
605
-
606
- ### Lazily Evaluated Debug Log Strings
607
-
608
- GH issue: [#375](https://github.com/ruby-amqp/bunny/pull/375)
609
-
610
- Contributed by Omer Katz.
611
-
612
-
613
-
614
- ## Changes between Bunny 2.1.0 and 2.2.0 (Sep 6th, 2015)
615
-
616
- ### Add :addresses to connect options
617
-
618
- Before this the connection options only allowed multiple hosts, an
619
- address is a combination of a host and a port. This makes it possible to
620
- specify different hosts with different ports.
621
-
622
- Contributed by Bart van Zon (Tele2).
623
-
624
- ### Recover from connection.close by default
625
-
626
- Bunny will now try to reconnect also when server sent connection.close is
627
- received, e.g. when a server is restarting (but also when the connection is
628
- force closed by the server). This is in-line with how many other clients behave.
629
- The old default was `recover_from_connection_close: false`.
630
-
631
- Contributed by Carl Hörberg (CloudAMQP).
632
-
633
-
634
- ## Changes between Bunny 2.0.0 and 2.1.0
635
-
636
- Bunny 2.1.0 has an **important breaking change**. It is highly
637
- advised that 2.1.0 is not mixed with earlier versions of Bunny
638
- in case your applications include **integers in message headers**.
639
-
640
- ### Integer Value Serialisation in Headers
641
-
642
- Integer values in headers are now serialised as signed 64-bit integers. Previously
643
- they were serialised as 32-bit unsigned integers, causing both underflows
644
- and overflows: incorrect values were observed by consumers.
645
-
646
- It is highly
647
- advised that 2.1.0 is not mixed with earlier versions of Bunny
648
- in case your applications include integers in message headers.
649
-
650
- If that's not the case, Bunny 2.1 will integeroperate with any earlier version
651
- starting with 0.9.0 just fine. Popular clients in other languages
652
- (e.g. Java and .NET) will interoperate with Bunny 2.1.0 without
653
- issues.
654
-
655
-
656
- ### Explicit Ruby 2.0 Requirement
657
-
658
- Bunny now requires Ruby 2.0 in the gemspec.
659
-
660
- Contributed by Carl Hörberg.
661
-
662
- ### JRuby Fix
663
-
664
- Bunny runs again on JRuby. Note that
665
- JRuby users are strongly advised to use March Hare instead.
666
-
667
- Contributed by Teodor Pripoae.
668
-
669
-
670
-
671
- ## Changes between Bunny 1.7.0 and 2.0.0
672
-
673
- Bunny `2.0` doesn't have any breaking API changes
674
- but drops Ruby 1.8 and 1.9 (both EOL'ed) support,
675
- hence the version.
676
-
677
- ### Minimum Required Ruby Version is 2.0
678
-
679
- Bunny `2.0` requires Ruby 2.0 or later.
680
-
681
- ## Non-Blocking Writes
682
-
683
- Bunny now uses non-blocking socket writes, uses a reduced
684
- number of writes for message publishing (frames are batched
685
- into a single write), and handles TCP back pressure from
686
- RabbitMQ better.
687
-
688
- Contributed by Irina Bednova and Michael Klishin.
689
-
690
- ### Reduced Timeout Use
691
-
692
- `Bunny::ContinuationQueue#poll` no longer relies on Ruby's `Timeout` which has
693
- numerous issues, including starting a new "interruptor" thread per operation,
694
- which is far from efficient.
695
-
696
- Contributed by Joe Eli McIlvain and Carl Hörberg.
697
-
698
- ### Capped Number of Connection Recovery Attempts
699
-
700
- `:recovery_attempts` is a new option that limits the number of
701
- connection recovery attempts performed by Bunny. `nil` means
702
- "no limit".
703
-
704
- Contributed by Irina Bednova.
705
-
706
- ### Bunny::Channel#basic_ack and Related Methods Improvements
707
-
708
- `Bunny::Channel#basic_ack`, `Bunny::Channel#basic_nack`, and `Bunny::Channel#basic_reject`
709
- now adjust delivery tags between connection recoveries, as well as have a default value for
710
- the second argument.
711
-
712
- Contributed by Wayne Conrad.
713
-
714
- ### Logger Output Remains Consistent
715
-
716
- Setting the `@logger.progname` attribute changes the output of the logger.
717
- This is not expected behaviour when the client provides a custom logger.
718
- Behaviour remains unchainged when the internally initialized logger is used.
719
-
720
- Contributed by Justin Carter.
721
-
722
- ### prefetch_count is Limited to 65535
723
-
724
- Since `basic.qos`'s `prefetch_count` field is of type `short` in the protocol,
725
- Bunny must enforce its maximum allowed value to `2^16 - 1` to avoid
726
- confusing issues due to overflow.
727
-
728
- ### Per-Consumer and Per-Channel Prefetch
729
-
730
- Recent RabbitMQ versions support `basic.qos` `global` flag, controlling whether
731
- `prefetch` applies per-consumer or per-channel. Bunny `Channel#prefetch` now
732
- allows flag to be set as optional parameter, with the same default behaviour as
733
- before (per-consumer).
734
-
735
- Contributed by tiredpixel.
736
-
737
-
738
- ## Changes between Bunny 1.6.0 and 1.7.0
739
-
740
- ### TLS Peer Verification Enabled by Default
741
-
742
- When using TLS, peer verification is now enabled by default.
743
- It is still possible to [disable verification](http://rubybunny.info/articles/tls.html), e.g. for convenient
744
- development locally.
745
-
746
- Peer verification is a means of protection against man-in-the-middle attacks
747
- and is highly recommended in production settings. However, it can be an inconvenience
748
- during local development. We believe it's time to have the default to be
749
- more secure.
750
-
751
- Contributed by Michael Klishin (Pivotal) and Andre Foeken (Nedap).
752
-
753
-
754
- ### Higher Default Connection Timeout
755
-
756
- Default connection timeout has been increased to 25 seconds. The older
757
- default of 5 seconds wasn't sufficient in some edge cases with DNS
758
- resolution (e.g. when primary DNS server is down).
759
-
760
- The value can be overriden at connection time.
761
-
762
- Contributed by Yury Batenko.
763
-
764
-
765
- ### Socket Read Timeout No Longer Set to 0 With Disabled Heartbeats
766
-
767
- GH issue: [#267](https://github.com/ruby-amqp/bunny/pull/267).
768
-
769
-
770
- ### JRuby Writes Fixes
771
-
772
- On JRuby, Bunny reverts back to using plain old `write(2)` for writes. The CRuby implementation
773
- on JRuby suffers from I/O incompatibilities. Until JRuby
774
-
775
- Bunny users who run on JRuby are highly recommended to switch to [March Hare](http://rubymarchhare.info),
776
- which has nearly identical API and is significantly more efficient.
777
-
778
-
779
- ### Bunny::Session#with_channel Synchornisation Improvements
780
-
781
- `Bunny::Session#with_channel` is now fully synchronised and won't run into `COMMAND_INVALID` errors
782
- when used from multiple threads that share a connection.
783
-
784
-
785
-
786
- ## Changes between Bunny 1.5.0 and 1.6.0
787
-
788
- ### TLSv1 by Default
789
-
790
- TLS connections now prefer TLSv1 (or later, if available) due to the recently discovered
791
- [POODLE attack](https://www.openssl.org/~bodo/ssl-poodle.pdf) on SSLv3.
792
-
793
- Contributed by Michael Klishin (Pivotal) and Justin Powers (Desk.com).
794
-
795
- GH issues:
796
-
797
- * [#259](https://github.com/ruby-amqp/bunny/pull/259)
798
- * [#260](https://github.com/ruby-amqp/bunny/pull/260)
799
- * [#261](https://github.com/ruby-amqp/bunny/pull/261)
800
-
801
-
802
- ### Socket Read and Write Timeout Improvements
803
-
804
- Bunny now sets a read timeout on the sockets it opens, and uses
805
- `IO.select` timeouts as the most reliable option available
806
- on Ruby 1.9 and later.
807
-
808
- GH issue: [#254](https://github.com/ruby-amqp/bunny/pull/254).
809
-
810
- Contributed by Andre Foeken (Nedap).
811
-
812
- ### Inline TLS Certificates Support
813
-
814
- TLS certificate options now accept inline certificates as well as
815
- file paths.
816
-
817
- GH issues: [#255](https://github.com/ruby-amqp/bunny/pull/255), [#256](https://github.com/ruby-amqp/bunny/pull/256).
818
-
819
- Contributed by Will Barrett (Sqwiggle).
820
-
821
-
822
- ## Changes between Bunny 1.4.0 and 1.5.0
823
-
824
- ### Improved Uncaught Exception Handler
825
-
826
- Uncaught exception handler now provides more information about the exception,
827
- including its caller (one more stack trace line).
828
-
829
- Contributed by Carl Hörberg (CloudAMQP).
830
-
831
-
832
- ### Convenience Method for Temporary (Server-named, Exclusive) Queue Declaration
833
-
834
- `Bunny::Channel#temporary_queue` is a convenience method that declares a new
835
- server-named exclusive queue:
836
-
837
- ``` ruby
838
- q = ch.temporary_queue
839
- ```
840
-
841
- Contributed by Daniel Schierbeck (Zendesk).
842
-
843
- ### Recovery Reliability Improvements
844
-
845
- Automatic connection recovery robustness improvements.
846
- Contributed by Andre Foeken (Nedap).
847
-
848
- ### Host Lists
849
-
850
- It is now possible to pass the `:hosts` option to `Bunny.new`/`Bunny::Session#initialize`.
851
- When connection to RabbitMQ (including during connection recovery), a random host
852
- will be chosen from the list.
853
-
854
- Connection shuffling and robustness improvements.
855
-
856
- Contributed by Andre Foeken (Nedap).
857
-
858
- ### Default Channel Removed
859
-
860
- Breaks compatibility with Bunny 0.8.x.
861
-
862
- `Bunny:Session#default_channel` was removed. Please open channels explicitly now,
863
- as all the examples in the docs do.
864
-
865
-
866
- ## Changes between Bunny 1.3.0 and 1.4.0
867
-
868
- ### Channel#wait_for_confirms Returns Immediately If All Publishes Confirmed
869
-
870
- Contributed by Matt Campbell.
871
-
872
- ### Publisher Confirms is In Sync After Recovery
873
-
874
- When a connection is recovered, the sequence counter resets on the
875
- broker, but not the client. To keep things in sync the client must store a confirmation
876
- offset after a recovery.
877
-
878
- Contributed by Devin Christensen.
879
-
880
- ### NoMethodError on Thread During Shutdown
881
-
882
- During abnormal termination, `Bunny::Session#close` no longer tries
883
- to call the non-existent `terminate_with` method on its origin
884
- thread.
885
-
886
-
887
- ## Changes between Bunny 1.2.0 and 1.3.0
888
-
889
- ### TLS Can Be Explicitly Disabled
890
-
891
- TLS now can be explicitly disabled even when connecting (without TLS)
892
- to the default RabbitMQ TLS/amqps port (5671):
893
-
894
- ``` ruby
895
- conn = Bunny.new(:port => 5671, :tls => false)
896
- ```
897
-
898
- Contributed by Muhan Zou.
899
-
900
-
901
- ### Single Threaded Connections Raise Shutdown Exceptions
902
-
903
- Single threaded Bunny connections will now raise exceptions
904
- that occur during shutdown as is (instead of trying to shut down
905
- I/O loop which only threaded ones have).
906
-
907
- Contributed by Carl Hörberg.
908
-
909
-
910
- ### Synchronization Improvements for Session#close
911
-
912
- `Bunny::Session#close` now better synchronizes state transitions,
913
- eliminating a few race condition scenarios with I/O reader thread.
914
-
915
-
916
- ### Bunny::Exchange.default Fix
917
-
918
- `Bunny::Exchange.default` no longer raises an exception.
919
-
920
- Note that it is a legacy compatibility method. Please use
921
- `Bunny::Channel#default_exchange` instead.
922
-
923
- Contributed by Justin Litchfield.
924
-
925
- GH issue [#211](https://github.com/ruby-amqp/bunny/pull/211).
926
-
927
- ### Bunny::Queue#pop_as_hash Removed
928
-
929
- `Bunny::Queue#pop_as_hash`, which was added to ease migration
930
- to Bunny 0.9, was removed.
931
-
932
- ### Bunny::Queue#pop Wraps Metadata
933
-
934
- `Bunny::Queue#pop` now wraps `basic.get-ok` and message properties
935
- into `Bunny::GetResponse` and `Bunny::MessageProperties`, just like
936
- `basic.consume` deliveries.
937
-
938
- GH issue: [#212](https://github.com/ruby-amqp/bunny/issues/212).
939
-
940
- ### Better Synchronization for Publisher Confirms
941
-
942
- Publisher confirms implementation now synchronizes unconfirmed
943
- set better.
944
-
945
- Contributed by Nicolas Viennot.
946
-
947
- ### Channel Allocation After Recovery
948
-
949
- Channel id allocator is no longer reset after recovery
950
- if there are channels open. Makes it possible to open channels
951
- on a recovered connection (in addition to the channels
952
- it already had).
953
-
954
-
955
-
956
- ## Changes between Bunny 1.1.0 and 1.2.0
957
-
958
- ### :key Supported in Bunny::Channel#queue_bind
959
-
960
- It is now possible to use `:key` (which Bunny versions prior to 0.9 used)
961
- as well as `:routing_key` as an argument to `Bunny::Queue#bind`.
962
-
963
- ### System Exceptions Not Rescued by the Library
964
-
965
- Bunny now rescues `StandardError` instead of `Exception` where
966
- it automatically does so (e.g. when dispatching deliveries to consumers).
967
-
968
- Contributed by Alex Young.
969
-
970
-
971
- ### Initial Socket Connection Timeout Again Raises Bunny::TCPConnectionFailed
972
-
973
- Initial socket connection timeout again raises `Bunny::TCPConnectionFailed`
974
- on the connection origin thread.
975
-
976
- ### Thread Leaks Plugged
977
-
978
- `Bunny::Session#close` on connections that have experienced a network failure
979
- will correctly clean up I/O and heartbeat sender threads.
980
-
981
- Contributed by m-o-e.
982
-
983
- ### Bunny::Concurrent::ContinuationQueue#poll Rounding Fix
984
-
985
- `Bunny::Concurrent::ContinuationQueue#poll` no longer floors the argument
986
- to the nearest second.
987
-
988
- Contributed by Brian Abreu.
989
-
990
- ### Routing Key Limit
991
-
992
- Per AMQP 0-9-1 spec, routing keys cannot be longer than 255 characters.
993
- `Bunny::Channel#basic_publish` and `Bunny::Exchange#publish` now enforces
994
- this limit.
995
-
996
- ### Nagle's Algorithm Disabled Correctly
997
-
998
- Bunny now properly disables [Nagle's algorithm](http://boundary.com/blog/2012/05/02/know-a-delay-nagles-algorithm-and-you/)
999
- on the sockets it opens. This likely means
1000
- significantly lower latency for workloads that involve
1001
- sending a lot of small messages very frequently.
1002
-
1003
- [Contributed](https://github.com/ruby-amqp/bunny/pull/187) by Nelson Gauthier (AirBnB).
1004
-
1005
- ### Internal Exchanges
1006
-
1007
- Exchanges now can be declared as internal:
1008
-
1009
- ``` ruby
1010
- ch = conn.create_channel
1011
- x = ch.fanout("bunny.tests.exchanges.internal", :internal => true)
1012
- ```
1013
-
1014
- Internal exchanges cannot be published to by clients and are solely used
1015
- for [Exchange-to-Exchange bindings](http://rabbitmq.com/e2e.html) and various
1016
- plugins but apps may still need to bind them. Now it is possible
1017
- to do so with Bunny.
1018
-
1019
- ### Uncaught Consumer Exceptions
1020
-
1021
- Uncaught consumer exceptions are now handled by uncaught exceptions
1022
- handler that can be defined per channel:
1023
-
1024
- ``` ruby
1025
- ch.on_uncaught_exception do |e, consumer|
1026
- # ...
1027
- end
1028
- ```
1029
-
1030
-
1031
-
1032
- ## Changes between Bunny 1.1.0.rc1 and 1.1.0
1033
-
1034
- ### Synchronized Session#create_channel and Session#close_channel
1035
-
1036
- Full bodies of `Bunny::Session#create_channel` and `Bunny::Session#close_channel`
1037
- are now synchronized, which makes sure concurrent `channel.open` and subsequent
1038
- operations (e.g. `exchange.declare`) do not result in connection-level exceptions
1039
- (incorrect connection state transitions).
1040
-
1041
- ### Corrected Recovery Log Message
1042
-
1043
- Bunny will now use actual recovery interval in the log.
1044
-
1045
- Contributed by Chad Fowler.
1046
-
1047
-
1048
-
1049
-
1050
- ## Changes between Bunny 1.1.0.pre2 and 1.1.0.rc1
1051
-
1052
- ### Full Channel State Recovery
1053
-
1054
- Channel recovery now involves recovery of publisher confirms and
1055
- transaction modes.
1056
-
1057
-
1058
- ### TLS Without Peer Verification
1059
-
1060
- Bunny now successfully performs TLS upgrade when peer verification
1061
- is disabled.
1062
-
1063
- Contributed by Jordan Curzon.
1064
-
1065
- ### Bunny::Session#with_channel Ensures the Channel is Closed
1066
-
1067
- `Bunny::Session#with_channel` now makes sure the channel is closed
1068
- even if provided block raises an exception
1069
-
1070
- Contributed by Carl Hoerberg.
1071
-
1072
-
1073
-
1074
- ### Channel Number = 0 is Rejected
1075
-
1076
- `Bunny::Session#create_channel` will now reject channel number 0.
1077
-
1078
-
1079
- ### Single Threaded Mode Fixes
1080
-
1081
- Single threaded mode no longer fails with
1082
-
1083
- ```
1084
- undefined method `event_loop'
1085
- ```
1086
-
1087
-
1088
-
1089
- ## Changes between Bunny 1.1.0.pre1 and 1.1.0.pre2
1090
-
1091
- ### connection.tune.channel_max No Longer Overflows
1092
-
1093
- `connection.tune.channel_max` could previously be configured to values
1094
- greater than 2^16 - 1 (65535). This would result in a silent overflow
1095
- during serialization. The issue was harmless in practice but is still
1096
- a bug that can be quite confusing.
1097
-
1098
- Bunny now caps max number of channels to 65535. This allows it to be
1099
- forward compatible with future RabbitMQ versions that may allow limiting
1100
- total # of open channels via server configuration.
1101
-
1102
- ### amq-protocol Update
1103
-
1104
- Minimum `amq-protocol` version is now `1.9.0` which includes
1105
- bug fixes and performance improvements for channel ID allocator.
1106
-
1107
- ### Thread Leaks Fixes
1108
-
1109
- Bunny will now correctly release heartbeat sender when allocating
1110
- a new one (usually happens only when connection recovers from a network
1111
- failure).
1112
-
1113
-
1114
- ## Changes between Bunny 1.0.0 and 1.1.0.pre1
1115
-
1116
- ### Versioned Delivery Tag Fix
1117
-
1118
- Versioned delivery tag now ensures all the arguments it operates
1119
- (original delivery tag, atomic fixnum instances, etc) are coerced to `Integer`
1120
- before comparison.
1121
-
1122
- GitHub issues: #171.
1123
-
1124
- ### User-Provided Loggers
1125
-
1126
- Bunny now can use any logger that provides the same API as Ruby standard library's `Logger`:
1127
-
1128
- ``` ruby
1129
- require "logger"
1130
- require "stringio"
1131
-
1132
- io = StringIO.new
1133
- # will log to `io`
1134
- Bunny.new(:logger => Logger.new(io))
1135
- ```
1136
-
1137
- ### Default CA's Paths Are Disabled on JRuby
1138
-
1139
- Bunny uses OpenSSL provided CA certificate paths. This
1140
- caused problems on some platforms on JRuby (see [jruby/jruby#155](https://github.com/jruby/jruby/issues/1055)).
1141
-
1142
- To avoid these issues, Bunny no longer uses default CA certificate paths on JRuby
1143
- (there are no changes for other Rubies), so it's necessary to provide
1144
- CA certificate explicitly.
1145
-
1146
- ### Fixes CPU Burn on JRuby
1147
-
1148
- Bunny now uses slightly different ways of continuously reading from the socket
1149
- on CRuby and JRuby, to prevent abnormally high CPU usage on JRuby after a
1150
- certain period of time (the frequency of `EWOULDBLOCK` being raised spiked
1151
- sharply).
1152
-
1153
-
1154
-
1155
- ## Changes between Bunny 1.0.0.rc2 and 1.0.0.rc3
1156
-
1157
- ### [Authentication Failure Notification](http://www.rabbitmq.com/auth-notification.html) Support
1158
-
1159
- `Bunny::AuthenticationFailureError` is a new auth failure exception
1160
- that subclasses `Bunny::PossibleAuthenticationFailureError` for
1161
- backwards compatibility.
1162
-
1163
- As such, `Bunny::PossibleAuthenticationFailureError`'s error message
1164
- has changed.
1165
-
1166
- This extension is available in RabbitMQ 3.2+.
1167
-
1168
-
1169
- ### Bunny::Session#exchange_exists?
1170
-
1171
- `Bunny::Session#exchange_exists?` is a new predicate that makes it
1172
- easier to check if a exchange exists.
1173
-
1174
- It uses a one-off channel and `exchange.declare` with `passive` set to true
1175
- under the hood.
1176
-
1177
- ### Bunny::Session#queue_exists?
1178
-
1179
- `Bunny::Session#queue_exists?` is a new predicate that makes it
1180
- easier to check if a queue exists.
1181
-
1182
- It uses a one-off channel and `queue.declare` with `passive` set to true
1183
- under the hood.
1184
-
1185
-
1186
- ### Inline TLS Certificates and Keys
1187
-
1188
- It is now possible to provide inline client
1189
- certificate and private key (as strings) instead
1190
- of filesystem paths. The options are the same:
1191
-
1192
- * `:tls` which, when set to `true`, will set SSL context up and switch to TLS port (5671)
1193
- * `:tls_cert` which now can be a client certificate (public key) in PEM format
1194
- * `:tls_key` which now can be a client key (private key) in PEM format
1195
- * `:tls_ca_certificates` which is an array of string paths to CA certificates in PEM format
1196
-
1197
- For example:
1198
-
1199
- ``` ruby
1200
- conn = Bunny.new(:tls => true,
1201
- :tls_cert => ENV["TLS_CERTIFICATE"],
1202
- :tls_key => ENV["TLS_PRIVATE_KEY"],
1203
- :tls_ca_certificates => ["./examples/tls/cacert.pem"])
1204
- ```
1205
-
1206
-
1207
-
1208
- ## Changes between Bunny 1.0.0.rc1 and 1.0.0.rc2
1209
-
1210
- ### Ruby 1.8.7 Compatibility Fixes
1211
-
1212
- Ruby 1.8.7 compatibility fixes around timeouts.
1213
-
1214
-
1215
-
1216
- ## Changes between Bunny 1.0.0.pre6 and 1.0.0.rc1
1217
-
1218
- ### amq-protocol Update
1219
-
1220
- Minimum `amq-protocol` version is now `1.8.0` which includes
1221
- a bug fix for messages exactly 128 Kb in size.
1222
-
1223
-
1224
- ### Add timeout Bunny::ConsumerWorkPool#join
1225
-
1226
- `Bunny::ConsumerWorkPool#join` now accepts an optional
1227
- timeout argument.
1228
-
1229
-
1230
- ## Changes between Bunny 1.0.0.pre5 and 1.0.0.pre6
1231
-
1232
- ### Respect RABBITMQ_URL value
1233
-
1234
- `RABBITMQ_URL` env variable will now have effect even if
1235
- Bunny.new is invoked without arguments.
1236
-
1237
-
1238
-
1239
- ## Changes between Bunny 1.0.0.pre4 and 1.0.0.pre5
1240
-
1241
- ### Ruby 1.8 Compatibility
1242
-
1243
- Bunny is Ruby 1.8-compatible again and no longer references
1244
- `RUBY_ENGINE`.
1245
-
1246
- ### Bunny::Session.parse_uri
1247
-
1248
- `Bunny::Session.parse_uri` is a new method that parses
1249
- connection URIs into hashes that `Bunny::Session#initialize`
1250
- accepts.
1251
-
1252
- ``` ruby
1253
- Bunny::Session.parse_uri("amqp://user:pwd@broker.eng.megacorp.local/myapp_qa")
1254
- ```
1255
-
1256
- ### Default Paths for TLS/SSL CA's on All OS'es
1257
-
1258
- Bunny now uses OpenSSL to detect default TLS/SSL CA's paths, extending
1259
- this feature to OS'es other than Linux.
1260
-
1261
- Contributed by Jingwen Owen Ou.
1262
-
1263
-
1264
- ## Changes between Bunny 1.0.0.pre3 and 1.0.0.pre4
1265
-
1266
- ### Default Paths for TLS/SSL CA's on Linux
1267
-
1268
- Bunny now will use the following TLS/SSL CA's paths on Linux by default:
1269
-
1270
- * `/etc/ssl/certs/ca-certificates.crt` on Ubuntu/Debian
1271
- * `/etc/ssl/certs/ca-bundle.crt` on Amazon Linux
1272
- * `/etc/ssl/ca-bundle.pem` on OpenSUSE
1273
- * `/etc/pki/tls/certs/ca-bundle.crt` on Fedora/RHEL
1274
-
1275
- and will log a warning if no CA files are available via default paths
1276
- or `:tls_ca_certificates`.
1277
-
1278
- Contributed by Carl Hörberg.
1279
-
1280
- ### Consumers Can Be Re-Registered From Bunny::Consumer#handle_cancellation
1281
-
1282
- It is now possible to re-register a consumer (and use any other synchronous methods)
1283
- from `Bunny::Consumer#handle_cancellation`, which is now invoked in the channel's
1284
- thread pool.
1285
-
1286
-
1287
- ### Bunny::Session#close Fixed for Single Threaded Connections
1288
-
1289
- `Bunny::Session#close` with single threaded connections no longer fails
1290
- with a nil pointer exception.
1291
-
1292
-
1293
-
1294
- ## Changes between Bunny 1.0.0.pre2 and 1.0.0.pre3
1295
-
1296
- This release has **breaking API changes**.
1297
-
1298
- ### Safe[r] basic.ack, basic.nack and basic.reject implementation
1299
-
1300
- Previously if a channel was recovered (reopened) by automatic connection
1301
- recovery before a message was acknowledged or rejected, it would cause
1302
- any operation on the channel that uses delivery tags to fail and
1303
- cause the channel to be closed.
1304
-
1305
- To avoid this issue, every channel keeps a counter of how many times
1306
- it has been reopened and marks delivery tags with them. Using a stale
1307
- tag to ack or reject a message will produce no method sent to RabbitMQ.
1308
- Note that unacknowledged messages will be requeued by RabbitMQ when connection
1309
- goes down anyway.
1310
-
1311
- This involves an API change: `Bunny::DeliveryMetadata#delivery_tag` is now
1312
- and instance of a class that responds to `#tag` and `#to_i` and is accepted
1313
- by `Bunny::Channel#ack` and related methods.
1314
-
1315
- Integers are still accepted by the same methods.
1316
-
1317
-
1318
- ## Changes between Bunny 1.0.0.pre1 and 1.0.0.pre2
1319
-
1320
- ### Exclusivity Violation for Consumers Now Raises a Reasonable Exception
1321
-
1322
- When a second consumer is registered for the same queue on different channels,
1323
- a reasonable exception (`Bunny::AccessRefused`) will be raised.
1324
-
1325
-
1326
- ### Reentrant Mutex Implementation
1327
-
1328
- Bunny now allows mutex impl to be configurable, uses reentrant Monitor
1329
- by default.
1330
-
1331
- Non-reentrant mutexes is a major PITA and may affect code that
1332
- uses Bunny.
1333
-
1334
- Avg. publishing throughput with Monitor drops slightly from
1335
- 5.73 Khz to 5.49 Khz (about 4% decrease), which is reasonable
1336
- for Bunny.
1337
-
1338
- Apps that need these 4% can configure what mutex implementation
1339
- is used on per-connection basis.
1340
-
1341
- ### Eliminated Race Condition in Bunny::Session#close
1342
-
1343
- `Bunny::Session#close` had a race condition that caused (non-deterministic)
1344
- exceptions when connection transport was closed before connection
1345
- reader loop was guaranteed to have stopped.
1346
-
1347
- ### connection.close Raises Exceptions on Connection Thread
1348
-
1349
- Connection-level exceptions (including when a connection is closed via
1350
- management UI or `rabbitmqctl`) will now be raised on the connection
1351
- thread so they
1352
-
1353
- * can be handled by applications
1354
- * do not start connection recovery, which may be uncalled for
1355
-
1356
- ### Client TLS Certificates are Optional
1357
-
1358
- Bunny will no longer require client TLS certificates. Note that CA certificate
1359
- list is still necessary.
1360
-
1361
- If RabbitMQ TLS configuration requires peer verification, client certificate
1362
- and private key are mandatory.
1363
-
1364
-
1365
- ## Changes between Bunny 0.9.0 and 1.0.0.pre1
1366
-
1367
- ### Publishing Over Closed Connections
1368
-
1369
- Publishing a message over a closed connection (during a network outage, before the connection
1370
- is open) will now correctly result in an exception.
1371
-
1372
- Contributed by Matt Campbell.
1373
-
1374
-
1375
- ### Reliability Improvement in Automatic Network Failure Recovery
1376
-
1377
- Bunny now ensures a new connection transport (socket) is initialized
1378
- before any recovery is attempted.
1379
-
1380
-
1381
- ### Reliability Improvement in Bunny::Session#create_channel
1382
-
1383
- `Bunny::Session#create_channel` now uses two separate mutexes to avoid
1384
- a (very rare) issue when the previous implementation would try to
1385
- re-acquire the same mutex and fail (Ruby mutexes are non-reentrant).
1386
-
1387
-
1388
-
1389
- ## Changes between Bunny 0.9.0.rc1 and 0.9.0.rc2
1390
-
1391
- ### Channel Now Properly Restarts Consumer Pool
1392
-
1393
- In a case when all consumers are cancelled, `Bunny::Channel`
1394
- will shut down its consumer delivery thread pool.
1395
-
1396
- It will also now mark the pool as not running so that it can be
1397
- started again successfully if new consumers are registered later.
1398
-
1399
- GH issue: #133.
1400
-
1401
-
1402
- ### Bunny::Queue#pop_waiting is Removed
1403
-
1404
- A little bit of background: on MRI, the method raised `ThreadErrors`
1405
- reliably. On JRuby, we used a different [internal] queue implementation
1406
- from JDK so it wasn't an issue.
1407
-
1408
- `Timeout.timeout` uses `Thread#kill` and `Thread#join`, both of which
1409
- eventually attempt to acquire a mutex used by Queue#pop, which Bunny
1410
- currently uses for continuations. The mutex is already has an owner
1411
- and so a ThreadError is raised.
1412
-
1413
- This is not a problem on JRuby because there we don't use Ruby's
1414
- Timeout and Queue and instead rely on a JDK concurrency primitive
1415
- which provides "poll with a timeout".
1416
-
1417
- [The issue with `Thread#kill` and `Thread#raise`](http://blog.headius.com/2008/02/ruby-threadraise-threadkill-timeoutrb.html)
1418
- has been first investigated and blogged about by Ruby implementers
1419
- in 2008.
1420
-
1421
- Finding a workaround will probably take a bit of time and may involve
1422
- reimplementing standard library and core classes.
1423
-
1424
- We don't want this issue to block Bunny 0.9 release. Neither we want
1425
- to ship a broken feature. So as a result, we will drop
1426
- Bunny::Queue#pop_waiting since it cannot be reliably implemented in a
1427
- reasonable amount of time on MRI.
1428
-
1429
- Per issue #131.
1430
-
1431
-
1432
- ### More Flexible SSLContext Configuration
1433
-
1434
- Bunny will now upgrade connection to SSL in `Bunny::Session#start`,
1435
- so it is possible to fine tune SSLContext and socket settings
1436
- before that:
1437
-
1438
- ``` ruby
1439
- require "bunny"
1440
-
1441
- conn = Bunny.new(:tls => true,
1442
- :tls_cert => "examples/tls/client_cert.pem",
1443
- :tls_key => "examples/tls/client_key.pem",
1444
- :tls_ca_certificates => ["./examples/tls/cacert.pem"])
1445
-
1446
- puts conn.transport.socket.inspect
1447
- puts conn.transport.tls_context.inspect
1448
- ```
1449
-
1450
- This also means that `Bunny.new` will now open the socket. Previously
1451
- it was only done when `Bunny::Session#start` was invoked.
1452
-
1453
-
1454
- ## Changes between Bunny 0.9.0.pre13 and 0.9.0.rc1
1455
-
1456
- ### TLS Support
1457
-
1458
- Bunny 0.9 finally supports TLS. There are 3 new options `Bunny.new` takes:
1459
-
1460
- * `:tls` which, when set to `true`, will set SSL context up and switch to TLS port (5671)
1461
- * `:tls_cert` which is a string path to the client certificate (public key) in PEM format
1462
- * `:tls_key` which is a string path to the client key (private key) in PEM format
1463
- * `:tls_ca_certificates` which is an array of string paths to CA certificates in PEM format
1464
-
1465
- An example:
1466
-
1467
- ``` ruby
1468
- conn = Bunny.new(:tls => true,
1469
- :tls_cert => "examples/tls/client_cert.pem",
1470
- :tls_key => "examples/tls/client_key.pem",
1471
- :tls_ca_certificates => ["./examples/tls/cacert.pem"])
1472
- ```
1473
-
1474
-
1475
- ### Bunny::Queue#pop_waiting
1476
-
1477
- **This function was removed in v0.9.0.rc2**
1478
-
1479
- `Bunny::Queue#pop_waiting` is a new function that mimics `Bunny::Queue#pop`
1480
- but will wait until a message is available. It uses a `:timeout` option and will
1481
- raise an exception if the timeout is hit:
1482
-
1483
- ``` ruby
1484
- # given 1 message in the queue,
1485
- # works exactly as Bunny::Queue#get
1486
- q.pop_waiting
1487
-
1488
- # given no messages in the queue, will wait for up to 0.5 seconds
1489
- # for a message to become available. Raises an exception if the timeout
1490
- # is hit
1491
- q.pop_waiting(:timeout => 0.5)
1492
- ```
1493
-
1494
- This method only makes sense for collecting Request/Reply ("RPC") replies.
1495
-
1496
-
1497
- ### Bunny::InvalidCommand is now Bunny::CommandInvalid
1498
-
1499
- `Bunny::InvalidCommand` is now `Bunny::CommandInvalid` (follows
1500
- the exception class naming convention based on response status
1501
- name).
1502
-
1503
-
1504
-
1505
- ## Changes between Bunny 0.9.0.pre12 and 0.9.0.pre13
1506
-
1507
- ### Channels Without Consumers Now Tear Down Consumer Pools
1508
-
1509
- Channels without consumers left (when all consumers were cancelled)
1510
- will now tear down their consumer work thread pools, thus making
1511
- `HotBunnies::Queue#subscribe(:block => true)` calls unblock.
1512
-
1513
- This is typically the desired behavior.
1514
-
1515
- ### Consumer and Channel Available In Delivery Handlers
1516
-
1517
- Delivery handlers registered via `Bunny::Queue#subscribe` now will have
1518
- access to the consumer and channel they are associated with via the
1519
- `delivery_info` argument:
1520
-
1521
- ``` ruby
1522
- q.subscribe do |delivery_info, properties, payload|
1523
- delivery_info.consumer # => the consumer this delivery is for
1524
- delivery_info.consumer # => the channel this delivery is on
1525
- end
1526
- ```
1527
-
1528
- This allows using `Bunny::Queue#subscribe` for one-off consumers
1529
- much easier, including when used with the `:block` option.
1530
-
1531
- ### Bunny::Exchange#wait_for_confirms
1532
-
1533
- `Bunny::Exchange#wait_for_confirms` is a convenience method on `Bunny::Exchange` that
1534
- delegates to the method with the same name on exchange's channel.
1535
-
1536
-
1537
- ## Changes between Bunny 0.9.0.pre11 and 0.9.0.pre12
1538
-
1539
- ### Ruby 1.8 Compatibility Regression Fix
1540
-
1541
- `Bunny::Socket` no longer uses Ruby 1.9-specific constants.
1542
-
1543
-
1544
- ### Bunny::Channel#wait_for_confirms Return Value Regression Fix
1545
-
1546
- `Bunny::Channel#wait_for_confirms` returns `true` or `false` again.
1547
-
1548
-
1549
-
1550
- ## Changes between Bunny 0.9.0.pre10 and 0.9.0.pre11
1551
-
1552
- ### Bunny::Session#create_channel Now Accepts Consumer Work Pool Size
1553
-
1554
- `Bunny::Session#create_channel` now accepts consumer work pool size as
1555
- the second argument:
1556
-
1557
- ``` ruby
1558
- # nil means channel id will be allocated by Bunny.
1559
- # 8 is the number of threads in the consumer work pool this channel will use.
1560
- ch = conn.create_channel(nil, 8)
1561
- ```
1562
-
1563
- ### Heartbeat Fix For Long Running Consumers
1564
-
1565
- Long running consumers that don't send any data will no longer
1566
- suffer from connections closed by RabbitMQ because of skipped
1567
- heartbeats.
1568
-
1569
- Activity tracking now takes sent frames into account.
1570
-
1571
-
1572
- ### Time-bound continuations
1573
-
1574
- If a network loop exception causes "main" session thread to never
1575
- receive a response, methods such as `Bunny::Channel#queue` will simply time out
1576
- and raise Timeout::Error now, which can be handled.
1577
-
1578
- It will not start automatic recovery for two reasons:
1579
-
1580
- * It will be started in the network activity loop anyway
1581
- * It may do more damage than good
1582
-
1583
- Kicking off network recovery manually is a matter of calling
1584
- `Bunny::Session#handle_network_failure`.
1585
-
1586
- The main benefit of this implementation is that it will never
1587
- block the main app/session thread forever, and it is really
1588
- efficient on JRuby thanks to a j.u.c. blocking queue.
1589
-
1590
- Fixes #112.
1591
-
1592
-
1593
- ### Logging Support
1594
-
1595
- Every Bunny connection now has a logger. By default, Bunny will use STDOUT
1596
- as logging device. This is configurable using the `:log_file` option:
1597
-
1598
- ``` ruby
1599
- require "bunny"
1600
-
1601
- conn = Bunny.new(:log_level => :warn)
1602
- ```
1603
-
1604
- or the `BUNNY_LOG_LEVEL` environment variable that can take one of the following
1605
- values:
1606
-
1607
- * `debug` (very verbose)
1608
- * `info`
1609
- * `warn`
1610
- * `error`
1611
- * `fatal` (least verbose)
1612
-
1613
- Severity is set to `warn` by default. To disable logging completely, set the level
1614
- to `fatal`.
1615
-
1616
- To redirect logging to a file or any other object that can act as an I/O entity,
1617
- pass it to the `:log_file` option.
1618
-
1619
-
1620
- ## Changes between Bunny 0.9.0.pre9 and 0.9.0.pre10
1621
-
1622
- This release contains a **breaking API change**.
1623
-
1624
- ### Concurrency Improvements On JRuby
1625
-
1626
- On JRuby, Bunny now will use `java.util.concurrent`-backed implementations
1627
- of some of the concurrency primitives. This both improves client stability
1628
- (JDK concurrency primitives has been around for 9 years and have
1629
- well-defined, documented semantics) and opens the door to solving
1630
- some tricky failure handling problems in the future.
1631
-
1632
-
1633
- ### Explicitly Closed Sockets
1634
-
1635
- Bunny now will correctly close the socket previous connection had
1636
- when recovering from network issues.
1637
-
1638
-
1639
- ### Bunny::Exception Now Extends StandardError
1640
-
1641
- `Bunny::Exception` now inherits from `StandardError` and not `Exception`.
1642
-
1643
- Naked rescue like this
1644
-
1645
- ``` ruby
1646
- begin
1647
- # ...
1648
- rescue => e
1649
- # ...
1650
- end
1651
- ```
1652
-
1653
- catches only descendents of `StandardError`. Most people don't
1654
- know this and this is a very counter-intuitive practice, but
1655
- apparently there is code out there that can't be changed that
1656
- depends on this behavior.
1657
-
1658
- This is a **breaking API change**.
1659
-
1660
-
1661
-
1662
- ## Changes between Bunny 0.9.0.pre8 and 0.9.0.pre9
1663
-
1664
- ### Bunny::Session#start Now Returns a Session
1665
-
1666
- `Bunny::Session#start` now returns a session instead of the default channel
1667
- (which wasn't intentional, default channel is a backwards-compatibility implementation
1668
- detail).
1669
-
1670
- `Bunny::Session#start` also no longer leaves dead threads behind if called multiple
1671
- times on the same connection.
1672
-
1673
-
1674
- ### More Reliable Heartbeat Sender
1675
-
1676
- Heartbeat sender no longer slips into an infinite loop if it encounters an exception.
1677
- Instead, it will just stop (and presumably re-started when the network error recovery
1678
- kicks in or the app reconnects manually).
1679
-
1680
-
1681
- ### Network Recovery After Delay
1682
-
1683
- Network reconnection now kicks in after a delay to avoid aggressive
1684
- reconnections in situations when we don't want to endlessly reconnect
1685
- (e.g. when the connection was closed via the Management UI).
1686
-
1687
- The `:network_recovery_interval` option passed to `Bunny::Session#initialize` and `Bunny.new`
1688
- controls the interval. Default is 5 seconds.
1689
-
1690
-
1691
- ### Default Heartbeat Value Is Now Server-Defined
1692
-
1693
- Bunny will now use heartbeat value provided by RabbitMQ by default.
1694
-
1695
-
1696
-
1697
- ## Changes between Bunny 0.9.0.pre7 and 0.9.0.pre8
1698
-
1699
- ### Stability Improvements
1700
-
1701
- Several stability improvements in the network
1702
- layer, connection error handling, and concurrency hazards.
1703
-
1704
-
1705
- ### Automatic Connection Recovery Can Be Disabled
1706
-
1707
- Automatic connection recovery now can be disabled by passing
1708
- the `:automatically_recover => false` option to `Bunny#initialize`).
1709
-
1710
- When the recovery is disabled, network I/O-related exceptions will
1711
- cause an exception to be raised in thee thread the connection was
1712
- started on.
1713
-
1714
-
1715
- ### No Timeout Control For Publishing
1716
-
1717
- `Bunny::Exchange#publish` and `Bunny::Channel#basic_publish` no
1718
- longer perform timeout control (using the timeout module) which
1719
- roughly increases throughput for flood publishing by 350%.
1720
-
1721
- Apps that need delivery guarantees should use publisher confirms.
1722
-
1723
-
1724
-
1725
- ## Changes between Bunny 0.9.0.pre6 and 0.9.0.pre7
1726
-
1727
- ### Bunny::Channel#on_error
1728
-
1729
- `Bunny::Channel#on_error` is a new method that lets you define
1730
- handlers for channel errors that are caused by methods that have no
1731
- responses in the protocol (`basic.ack`, `basic.reject`, and `basic.nack`).
1732
-
1733
- This is rarely necessary but helps make sure no error goes unnoticed.
1734
-
1735
- Example:
1736
-
1737
- ``` ruby
1738
- channel.on_error |ch, channel_close|
1739
- puts channel_close.inspect
1740
- end
1741
- ```
1742
-
1743
- ### Fixed Framing of Larger Messages With Unicode Characters
1744
-
1745
- Larger (over 128K) messages with non-ASCII characters are now always encoded
1746
- correctly with amq-protocol `1.2.0`.
1747
-
1748
-
1749
- ### Efficiency Improvements
1750
-
1751
- Publishing of large messages is now done more efficiently.
1752
-
1753
- Contributed by Greg Brockman.
1754
-
1755
-
1756
- ### API Reference
1757
-
1758
- [Bunny API reference](http://reference.rubybunny.info) is now up online.
1759
-
1760
-
1761
- ### Bunny::Channel#basic_publish Support For :persistent
1762
-
1763
- `Bunny::Channel#basic_publish` now supports both
1764
- `:delivery_mode` and `:persistent` options.
1765
-
1766
- ### Bunny::Channel#nacked_set
1767
-
1768
- `Bunny::Channel#nacked_set` is a counter-part to `Bunny::Channel#unacked_set`
1769
- that contains `basic.nack`-ed (rejected) delivery tags.
1770
-
1771
-
1772
- ### Single-threaded Network Activity Mode
1773
-
1774
- Passing `:threaded => false` to `Bunny.new` now will use the same
1775
- thread for publisher confirmations (may be useful for retry logic
1776
- implementation).
1777
-
1778
- Contributed by Greg Brockman.
1779
-
1780
-
1781
- ## Changes between Bunny 0.9.0.pre5 and 0.9.0.pre6
1782
-
1783
- ### Automatic Network Failure Recovery
1784
-
1785
- Automatic Network Failure Recovery is a new Bunny feature that was earlier
1786
- impemented and vetted out in [amqp gem](http://rubyamqp.info). What it does
1787
- is, when a network activity loop detects an issue, it will try to
1788
- periodically recover [first TCP, then] AMQP 0.9.1 connection, reopen
1789
- all channels, recover all exchanges, queues, bindings and consumers
1790
- on those channels (to be clear: this only includes entities and consumers added via
1791
- Bunny).
1792
-
1793
- Publishers and consumers will continue operating shortly after the network
1794
- connection recovers.
1795
-
1796
- Learn more in the [Error Handling and Recovery](http://rubybunny.info/articles/error_handling.html)
1797
- documentation guide.
1798
-
1799
- ### Confirms Listeners
1800
-
1801
- Bunny now supports listeners (callbacks) on
1802
-
1803
- ``` ruby
1804
- ch.confirm_select do |delivery_tag, multiple, nack|
1805
- # handle confirms (e.g. perform retries) here
1806
- end
1807
- ```
1808
-
1809
- Contributed by Greg Brockman.
1810
-
1811
- ### Publisher Confirms Improvements
1812
-
1813
- Publisher confirms implementation now uses non-strict equality (`<=`) for
1814
- cases when multiple messages are confirmed by RabbitMQ at once.
1815
-
1816
- `Bunny::Channel#unconfirmed_set` is now part of the public API that lets
1817
- developers access unconfirmed delivery tags to perform retries and such.
1818
-
1819
- Contributed by Greg Brockman.
1820
-
1821
- ### Publisher Confirms Concurrency Fix
1822
-
1823
- `Bunny::Channel#wait_for_confirms` will now correctly block the calling
1824
- thread until all pending confirms are received.
1825
-
1826
-
1827
- ## Changes between Bunny 0.9.0.pre4 and 0.9.0.pre5
1828
-
1829
- ### Channel Errors Reset
1830
-
1831
- Channel error information is now properly reset when a channel is (re)opened.
1832
-
1833
- GH issue: #83.
1834
-
1835
- ### Bunny::Consumer#initial Default Change
1836
-
1837
- the default value of `Bunny::Consumer` noack argument changed from false to true
1838
- for consistency.
1839
-
1840
- ### Bunny::Session#prefetch Removed
1841
-
1842
- Global prefetch is not implemented in RabbitMQ, so `Bunny::Session#prefetch`
1843
- is gone from the API.
1844
-
1845
- ### Queue Redeclaration Bug Fix
1846
-
1847
- Fixed a problem when a queue was not declared after being deleted and redeclared
1848
-
1849
- GH issue: #80
1850
-
1851
- ### Channel Cache Invalidation
1852
-
1853
- Channel queue and exchange caches are now properly invalidated when queues and
1854
- exchanges are deleted.
1855
-
1856
-
1857
- ## Changes between Bunny 0.9.0.pre3 and 0.9.0.pre4
1858
-
1859
- ### Heartbeats Support Fixes
1860
-
1861
- Heartbeats are now correctly sent at safe intervals (half of the configured
1862
- interval). In addition, setting `:heartbeat => 0` (or `nil`) will disable
1863
- heartbeats, just like in Bunny 0.8 and [amqp gem](http://rubyamqp.info).
1864
-
1865
- Default `:heartbeat` value is now `600` (seconds), the same as RabbitMQ 3.0
1866
- default.
1867
-
1868
-
1869
- ### Eliminate Race Conditions When Registering Consumers
1870
-
1871
- Fixes a potential race condition between `basic.consume-ok` handler and
1872
- delivery handler when a consumer is registered for a queue that has
1873
- messages in it.
1874
-
1875
- GH issue: #78.
1876
-
1877
- ### Support for Alternative Authentication Mechanisms
1878
-
1879
- Bunny now supports two authentication mechanisms and can be extended
1880
- to support more. The supported methods are `"PLAIN"` (username
1881
- and password) and `"EXTERNAL"` (typically uses TLS, UNIX sockets or
1882
- another mechanism that does not rely on username/challenge pairs).
1883
-
1884
- To use the `"EXTERNAL"` method, pass `:auth_mechanism => "EXTERNAL"` to
1885
- `Bunny.new`:
1886
-
1887
- ``` ruby
1888
- # uses the EXTERNAL authentication mechanism
1889
- conn = Bunny.new(:auth_method => "EXTERNAL")
1890
- conn.start
1891
- ```
1892
-
1893
- ### Bunny::Consumer#cancel
1894
-
1895
- A new high-level API method: `Bunny::Consumer#cancel`, can be used to
1896
- cancel a consumer. `Bunny::Queue#subscribe` will now return consumer
1897
- instances when the `:block` option is passed in as `false`.
1898
-
1899
-
1900
- ### Bunny::Exchange#delete Behavior Change
1901
-
1902
- `Bunny::Exchange#delete` will no longer delete pre-declared exchanges
1903
- that cannot be declared by Bunny (`amq.*` and the default exchange).
1904
-
1905
-
1906
- ### Bunny::DeliveryInfo#redelivered?
1907
-
1908
- `Bunny::DeliveryInfo#redelivered?` is a new method that is an alias
1909
- to `Bunny::DeliveryInfo#redelivered` but follows the Ruby community convention
1910
- about predicate method names.
1911
-
1912
- ### Corrected Bunny::DeliveryInfo#delivery_tag Name
1913
-
1914
- `Bunny::DeliveryInfo#delivery_tag` had a typo which is now fixed.
1915
-
1916
-
1917
- ## Changes between Bunny 0.9.0.pre2 and 0.9.0.pre3
1918
-
1919
- ### Client Capabilities
1920
-
1921
- Bunny now correctly lists RabbitMQ extensions it currently supports in client capabilities:
1922
-
1923
- * `basic.nack`
1924
- * exchange-to-exchange bindings
1925
- * consumer cancellation notifications
1926
- * publisher confirms
1927
-
1928
- ### Publisher Confirms Support
1929
-
1930
- [Lightweight Publisher Confirms](http://www.rabbitmq.com/blog/2011/02/10/introducing-publisher-confirms/) is a
1931
- RabbitMQ feature that lets publishers keep track of message routing without adding
1932
- noticeable throughput degradation as it is the case with AMQP 0.9.1 transactions.
1933
-
1934
- Bunny `0.9.0.pre3` supports publisher confirms. Publisher confirms are enabled per channel,
1935
- using the `Bunny::Channel#confirm_select` method. `Bunny::Channel#wait_for_confirms` is a method
1936
- that blocks current thread until the client gets confirmations for all unconfirmed published
1937
- messages:
1938
-
1939
- ``` ruby
1940
- ch = connection.create_channel
1941
- ch.confirm_select
1942
-
1943
- ch.using_publisher_confirmations? # => true
1944
-
1945
- q = ch.queue("", :exclusive => true)
1946
- x = ch.default_exchange
1947
-
1948
- 5000.times do
1949
- x.publish("xyzzy", :routing_key => q.name)
1950
- end
1951
-
1952
- ch.next_publish_seq_no.should == 5001
1953
- ch.wait_for_confirms # waits until all 5000 published messages are acknowledged by RabbitMQ
1954
- ```
1955
-
1956
-
1957
- ### Consumers as Objects
1958
-
1959
- It is now possible to register a consumer as an object instead
1960
- of a block. Consumers that are class instances support cancellation
1961
- notifications (e.g. when a queue they're registered with is deleted).
1962
-
1963
- To support this, Bunny introduces two new methods: `Bunny::Channel#basic_consume_with`
1964
- and `Bunny::Queue#subscribe_with`, that operate on consumer objects. Objects are
1965
- supposed to respond to three selectors:
1966
-
1967
- * `:handle_delivery` with 3 arguments
1968
- * `:handle_cancellation` with 1 argument
1969
- * `:consumer_tag=` with 1 argument
1970
-
1971
- An example:
1972
-
1973
- ``` ruby
1974
- class ExampleConsumer < Bunny::Consumer
1975
- def cancelled?
1976
- @cancelled
1977
- end
1978
-
1979
- def handle_cancellation(_)
1980
- @cancelled = true
1981
- end
1982
- end
1983
-
1984
- # "high-level" API
1985
- ch1 = connection.create_channel
1986
- q1 = ch1.queue("", :auto_delete => true)
1987
-
1988
- consumer = ExampleConsumer.new(ch1, q)
1989
- q1.subscribe_with(consumer)
1990
-
1991
- # "low-level" API
1992
- ch2 = connection.create_channel
1993
- q1 = ch2.queue("", :auto_delete => true)
1994
-
1995
- consumer = ExampleConsumer.new(ch2, q)
1996
- ch2.basic_consume_with.(consumer)
1997
- ```
1998
-
1999
- ### RABBITMQ_URL ENV variable support
2000
-
2001
- If `RABBITMQ_URL` environment variable is set, Bunny will assume
2002
- it contains a valid amqp URI string and will use it. This is convenient
2003
- with some PaaS technologies such as Heroku.
2004
-
2005
-
2006
- ## Changes between Bunny 0.9.0.pre1 and 0.9.0.pre2
2007
-
2008
- ### Change Bunny::Queue#pop default for :ack to false
2009
-
2010
- It makes more sense for beginners that way.
2011
-
2012
-
2013
- ### Bunny::Queue#subscribe now support the new :block option
2014
-
2015
- `Bunny::Queue#subscribe` support the new `:block` option
2016
- (a boolean).
2017
-
2018
- It controls whether the current thread will be blocked
2019
- by `Bunny::Queue#subscribe`.
2020
-
2021
-
2022
- ### Bunny::Exchange#publish now supports :key again
2023
-
2024
- `Bunny::Exchange#publish` now supports `:key` as an alias for
2025
- `:routing_key`.
2026
-
2027
-
2028
- ### Bunny::Session#queue et al.
2029
-
2030
- `Bunny::Session#queue`, `Bunny::Session#direct`, `Bunny::Session#fanout`, `Bunny::Session#topic`,
2031
- and `Bunny::Session#headers` were added to simplify migration. They all delegate to their respective
2032
- `Bunny::Channel` methods on the default channel every connection has.
2033
-
2034
-
2035
- ### Bunny::Channel#exchange, Bunny::Session#exchange
2036
-
2037
- `Bunny::Channel#exchange` and `Bunny::Session#exchange` were added to simplify
2038
- migration:
2039
-
2040
- ``` ruby
2041
- b = Bunny.new
2042
- b.start
2043
-
2044
- # uses default connection channel
2045
- x = b.exchange("logs.events", :topic)
2046
- ```
2047
-
2048
- ### Bunny::Queue#subscribe now properly takes 3 arguments
2049
-
2050
- ``` ruby
2051
- q.subscribe(:exclusive => false, :ack => false) do |delivery_info, properties, payload|
2052
- # ...
2053
- end
2054
- ```
2055
-
2056
-
2057
-
2058
- ## Changes between Bunny 0.8.x and 0.9.0.pre1
2059
-
2060
- ### New convenience functions: Bunny::Channel#fanout, Bunny::Channel#topic
2061
-
2062
- `Bunny::Channel#fanout`, `Bunny::Channel#topic`, `Bunny::Channel#direct`, `Bunny::Channel#headers`,
2063
- and`Bunny::Channel#default_exchange` are new convenience methods to instantiate exchanges:
2064
-
2065
- ``` ruby
2066
- conn = Bunny.new
2067
- conn.start
2068
-
2069
- ch = conn.create_channel
2070
- x = ch.fanout("logging.events", :durable => true)
2071
- ```
2072
-
2073
-
2074
- ### Bunny::Queue#pop and consumer handlers (Bunny::Queue#subscribe) signatures have changed
2075
-
2076
- Bunny `< 0.9.x` example:
2077
-
2078
- ``` ruby
2079
- h = queue.pop
2080
-
2081
- puts h[:delivery_info], h[:header], h[:payload]
2082
- ```
2083
-
2084
- Bunny `>= 0.9.x` example:
2085
-
2086
- ``` ruby
2087
- delivery_info, properties, payload = queue.pop
2088
- ```
2089
-
2090
- The improve is both in that Ruby has positional destructuring, e.g.
2091
-
2092
- ``` ruby
2093
- delivery_info, _, content = q.pop
2094
- ```
2095
-
2096
- but not hash destructuring, like, say, Clojure does.
2097
-
2098
- In addition we return nil for content when it should be nil
2099
- (basic.get-empty) and unify these arguments betwee
2100
-
2101
- * Bunny::Queue#pop
2102
-
2103
- * Consumer (Bunny::Queue#subscribe, etc) handlers
2104
-
2105
- * Returned message handlers
2106
-
2107
- The unification moment was the driving factor.
2108
-
2109
-
2110
-
2111
- ### Bunny::Client#write now raises Bunny::ConnectionError
2112
-
2113
- Bunny::Client#write now raises `Bunny::ConnectionError` instead of `Bunny::ServerDownError` when network
2114
- I/O operations fail.
2115
-
2116
-
2117
- ### Bunny::Client.create_channel now uses a bitset-based allocator
2118
-
2119
- Instead of reusing channel instances, `Bunny::Client.create_channel` now opens new channels and
2120
- uses bitset-based allocator to keep track of used channel ids. This avoids situations when
2121
- channels are reused or shared without developer's explicit intent but also work well for
2122
- long running applications that aggressively open and release channels.
2123
-
2124
- This is also how amqp gem and RabbitMQ Java client manage channel ids.
2125
-
2126
-
2127
- ### Bunny::ServerDownError is now Bunny::TCPConnectionFailed
2128
-
2129
- `Bunny::ServerDownError` is now an alias for `Bunny::TCPConnectionFailed`