bunny 2.14.2 → 2.22.0

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