bunny 2.15.0 → 2.22.0

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