bunny 2.14.4 → 2.19.0

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