hutch 0.25.0.pre.rc1-java → 2.0.0.rc1-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +402 -5
  3. data/LICENSE +1 -0
  4. data/README.md +157 -47
  5. data/bin/ci/before_build.sh +20 -0
  6. data/bin/ci/before_build_docker.sh +15 -0
  7. data/bin/ci/install_on_debian.sh +46 -0
  8. data/lib/hutch/acknowledgements/nack_on_all_failures.rb +1 -1
  9. data/lib/hutch/adapters/bunny.rb +29 -1
  10. data/lib/hutch/adapters/march_hare.rb +24 -0
  11. data/lib/hutch/broker.rb +122 -36
  12. data/lib/hutch/cli.rb +23 -12
  13. data/lib/hutch/config.rb +45 -13
  14. data/lib/hutch/consumer.rb +63 -4
  15. data/lib/hutch/error_handlers/airbrake.rb +20 -2
  16. data/lib/hutch/error_handlers/base.rb +15 -0
  17. data/lib/hutch/error_handlers/bugsnag.rb +30 -0
  18. data/lib/hutch/error_handlers/honeybadger.rb +11 -3
  19. data/lib/hutch/error_handlers/logger.rb +7 -2
  20. data/lib/hutch/error_handlers/rollbar.rb +28 -0
  21. data/lib/hutch/error_handlers/sentry.rb +13 -11
  22. data/lib/hutch/error_handlers.rb +2 -1
  23. data/lib/hutch/publisher.rb +1 -1
  24. data/lib/hutch/serializers/json.rb +3 -3
  25. data/lib/hutch/tracers/datadog.rb +18 -0
  26. data/lib/hutch/tracers.rb +1 -1
  27. data/lib/hutch/version.rb +1 -2
  28. data/lib/hutch/waiter.rb +1 -1
  29. data/lib/hutch/worker.rb +74 -8
  30. data/lib/hutch.rb +8 -4
  31. data/lib/yard-settings/yard-settings.rb +2 -2
  32. data/spec/hutch/broker_spec.rb +222 -10
  33. data/spec/hutch/cli_spec.rb +25 -9
  34. data/spec/hutch/config_spec.rb +84 -12
  35. data/spec/hutch/consumer_spec.rb +93 -4
  36. data/spec/hutch/error_handlers/airbrake_spec.rb +23 -1
  37. data/spec/hutch/error_handlers/bugsnag_spec.rb +56 -0
  38. data/spec/hutch/error_handlers/honeybadger_spec.rb +22 -1
  39. data/spec/hutch/error_handlers/logger_spec.rb +12 -1
  40. data/spec/hutch/error_handlers/rollbar_spec.rb +45 -0
  41. data/spec/hutch/error_handlers/sentry_spec.rb +27 -2
  42. data/spec/hutch/message_spec.rb +1 -1
  43. data/spec/hutch/tracers/datadog_spec.rb +46 -0
  44. data/spec/hutch/waiter_spec.rb +2 -2
  45. data/spec/hutch/worker_spec.rb +139 -25
  46. data/spec/integration/channel_recovery_spec.rb +187 -0
  47. data/spec/integration/publish_consume_spec.rb +47 -0
  48. metadata +35 -61
  49. data/.gitignore +0 -10
  50. data/.rspec +0 -1
  51. data/.travis.yml +0 -19
  52. data/.yardopts +0 -5
  53. data/Gemfile +0 -33
  54. data/Guardfile +0 -14
  55. data/Rakefile +0 -21
  56. data/examples/consumer.rb +0 -13
  57. data/examples/producer.rb +0 -10
  58. data/hutch.gemspec +0 -29
  59. data/lib/hutch/error_handlers/opbeat.rb +0 -24
  60. data/lib/hutch/tracers/opbeat.rb +0 -37
  61. data/spec/hutch/error_handlers/opbeat_spec.rb +0 -22
  62. data/spec/spec_helper.rb +0 -42
  63. data/spec/tracers/opbeat_spec.rb +0 -44
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f44f4b993e19281740ceb3c410f363b72d74bc0b
4
- data.tar.gz: fd44e56bac8081fb3902b1e33105a4a806fa7995
2
+ SHA256:
3
+ metadata.gz: 459b3765c6db0fa6a1421837a714b8ced3e3c7e036c5d3cd058d1eb8180862b4
4
+ data.tar.gz: 2c1f461463321e705e2464373093135bf307b68dac9f08b284e8c5f6c9e710db
5
5
  SHA512:
6
- metadata.gz: 134172ba6b7f1c79ae2c332d76cabf87d5c6a2032fc1d1a875b9ed587010620533b2792148efa925ee2617c05f321206e08c3053c042674adaef35c2773e4e82
7
- data.tar.gz: 82c6f22d092760191c5a59f7d20588ad90ea500ed4df9324b579b5a6137b14bd1a11ef9e72cd3af47796b13629479742d276e65edf43d6ddc59f42bea817085e
6
+ metadata.gz: f083551b329e1911f0b16837ae9cdd868aed516ff57ec69fb01435c0686485260145ff478db42257b22640c517ba08872e01785eee02ffaa14b9b655ddb4dd18
7
+ data.tar.gz: e3c8b5ac42f24483a773167eb79d01e9e29e71859c0a78ccf01d59b018ec1f57a1a5c26c8da47ad9ebb743b04fed9d67989802eb0f495bd894c1b3c51cb830c3
data/CHANGELOG.md CHANGED
@@ -1,8 +1,406 @@
1
- ## 0.25.0 (unreleased)
1
+ # Hutch Change Log
2
2
 
3
- No changes yet.
3
+ ## 2.0.0 (TBD)
4
4
 
5
+ ### Breaking Changes
5
6
 
7
+ * Ruby `3.2` or JRuby `10` is now required
8
+ * The Datadog tracer now depends on the [`datadog`](https://github.com/DataDog/dd-trace-rb)
9
+ gem, which replaces the EOL `ddtrace`
10
+ ([migration guide](https://github.com/DataDog/dd-trace-rb/blob/master/docs/UpgradeGuide2.md))
11
+ * `Hutch::ErrorHandlers::SentryRaven` has been replaced by
12
+ `Hutch::ErrorHandlers::Sentry`, backed by `sentry-ruby`
13
+ ([migration guide](https://docs.sentry.io/platforms/ruby/migration/))
14
+ * Messages are serialized with the stdlib `json` instead of `multi_json`, which
15
+ means that `MultiJson` configuration such as `MultiJson.use(:oj)` no longer
16
+ affects Hutch
17
+
18
+ ### Consumer Recovery After a RabbitMQ 4.3 Quorum Queue Consumer Timeout
19
+
20
+ RabbitMQ 4.3 quorum queues cancel a timed out consumer with `basic.cancel`
21
+ instead of closing the channel. Hutch 1.4.0 does not react to that, so on 4.3
22
+ a consumer stops consuming its queue until the worker restarts.
23
+
24
+ Workers now re-subscribe consumers cancelled by the server, but only if
25
+ the queue still exists: a `basic.cancel` carries no reason, so a consumer
26
+ timeout is indistinguishable from a queue deletion. The consumer channel is
27
+ replaced in the process, so the deliveries the cancelled consumer still held
28
+ are requeued instead of dropped.
29
+
30
+ Handlers that are still running get a graceful exit to finish before
31
+ the old channel is closed, and their acknowledgements are dropped rather than
32
+ sent on the new channel, where their delivery tags mean nothing.
33
+
34
+ ### Connection URIs Are Now Percent-Decoded
35
+
36
+ The virtual host, username and password of a connection URI are now decoded, as
37
+ [the URI specification](https://www.rabbitmq.com/docs/uri-spec) requires.
38
+ `amqp://host/%2F` connects to the default virtual host instead of one literally
39
+ named `%2F`, and credentials containing a space, `#` or `@` authenticate again.
40
+
41
+ Reported by @deissimon.
42
+
43
+ GitHub issue: [#422](https://github.com/ruby-amqp/hutch/issues/422)
44
+
45
+ ### Fixed Two JRuby Regressions
46
+
47
+ Opening a channel raised, and the `march_hare` adapter did not declare the
48
+ exchange it instantiated.
49
+
50
+ GitHub issue: [#427](https://github.com/ruby-amqp/hutch/issues/427)
51
+
52
+ ### The JRuby Variant Is Revived
53
+
54
+ The `java` platform gem, which depends on March Hare instead of Bunny, was last
55
+ published as `0.25.0` in January 2018 and has seen little more than CI version
56
+ bumps since. This release requires JRuby `10` and `march_hare` `4.7.0`, adds a
57
+ JRuby CI job, and publishes the gem again.
58
+
59
+ Recovering a channel the broker closed remains Bunny-only: `MarchHare::Channel`
60
+ has no `on_error` callback and no `reopen`.
61
+
62
+ ## 1.4.0 (Apr 7, 2026)
63
+
64
+ ### Ruby 3.0 is Now Required
65
+
66
+ This version adopts [Bunny `3.x`](https://github.com/ruby-amqp/bunny/releases/tag/3.0.0)
67
+ and as a result, requires Ruby 3.0.
68
+
69
+ ### `without_namespace` Consumer DSL Option
70
+
71
+ Consumers can now opt out of the automatic namespace prefix
72
+ for their queue name using the `without_namespace` DSL method:
73
+
74
+ ``` ruby
75
+ class DeadLetterConsumer
76
+ include Hutch::Consumer
77
+ consume 'dead.letters'
78
+ queue_name 'deadletter'
79
+ without_namespace
80
+ end
81
+ ```
82
+
83
+ Originally contributed by @tlloydthwaites.
84
+
85
+ GitHub issue: [#393](https://github.com/ruby-amqp/hutch/pull/393)
86
+
87
+ ### Consumer Channel Recovery After Delivery Acknowledgement Timeout
88
+
89
+ Hutch now automatically "recovers" (reopens) consumer channels closed by RabbitMQ
90
+ due to a [delivery acknowledgement timeout](https://www.rabbitmq.com/docs/consumers#acknowledgement-timeout).
91
+
92
+ Note that this exception indicates a potential issue on Hutch's end:
93
+ a delivery was not acknowledged in time (30 minutes by default). Even then,
94
+ recovering the channel in this specific scenario is an operational improvement.
95
+
96
+ Contributed by @Garaio-REM.
97
+
98
+ GitHub issue: [#414](https://github.com/ruby-amqp/hutch/pull/414)
99
+
100
+ ### Migrated Datadog Tracer From the `ddtrace` Gem to `datadog`
101
+
102
+ The Datadog tracer now uses the `datadog` gem instead of the deprecated `ddtrace`.
103
+ The `ddtrace` gem is still supported but emits a deprecation warning at load time.
104
+ Support for `ddtrace` will be removed in Hutch 2.0.
105
+
106
+ ### Deprecated `SentryRaven` Error Handler
107
+
108
+ `Hutch::ErrorHandlers::SentryRaven` now emits a deprecation warning and will be
109
+ removed in Hutch 2.0. Use `Hutch::ErrorHandlers::Sentry` (backed by `sentry-ruby`) instead.
110
+
111
+ ### Rails 8.x Compatibility
112
+
113
+ Contributed by @drobny.
114
+
115
+ GitHub issue: [#404](https://github.com/ruby-amqp/hutch/pull/404)
116
+
117
+
118
+ ## 1.3.0 (Nov 11, 2024)
119
+
120
+ ### Ruby 3.2 Compatibility
121
+
122
+ GitHub issue: [#392](https://github.com/ruby-amqp/hutch/pull/392)
123
+
124
+ ### Relaxed ActiveSupport Dependency Constraints
125
+
126
+ Contributed by drobny.
127
+
128
+ GitHub issue: [#402](https://github.com/ruby-amqp/hutch/pull/402)
129
+
130
+ ### Client-Provided Connection Name
131
+
132
+ Contributed by @sharshenov.
133
+
134
+ GitHub issue: [#399](https://github.com/ruby-amqp/hutch/pull/399)
135
+
136
+
137
+ ## 1.1.1 (March 18th, 2022)
138
+
139
+ ### Dependency Bump
140
+
141
+ Hutch now allows ActiveSupport 7.x.
142
+
143
+
144
+ ## 1.1.0 (July 26th, 2021)
145
+
146
+ ### Bugsnag Error Handler
147
+
148
+ Contributed by @ivanhuang1.
149
+
150
+ GitHub issue: [#362](https://github.com/ruby-amqp/hutch/pull/362)
151
+
152
+ ### Datadog Tracer
153
+
154
+ Contributed by Karol @Azdaroth Galanciak.
155
+
156
+ GitHub issue: [#360](https://github.com/ruby-amqp/hutch/pull/360)
157
+
158
+ ### Updated Sentry Error Handler
159
+
160
+ Contributed by Karol @Azdaroth Galanciak.
161
+
162
+ GitHub issue: [#363](https://github.com/ruby-amqp/hutch/pull/363)
163
+
164
+ ### Type Casting for Values Set Using Hutch::Config.set
165
+
166
+ Values set with `Hutch::Config.set` now have expected setting type casting
167
+ applied to them.
168
+
169
+ Contributed by Karol @Azdaroth Galanciak.
170
+
171
+ GitHub issue: [#358](https://github.com/ruby-amqp/hutch/pull/358)
172
+
173
+ ### Wider MultiJson Adoption
174
+
175
+ Contributed by Ulysse @BuonOmo Buonomo.
176
+
177
+ GitHub issue: [#356](https://github.com/ruby-amqp/hutch/pull/356)
178
+
179
+ ### README Corrections
180
+
181
+ Contributed by Johan @johankok Kok.
182
+
183
+ GitHub issue: [#353](https://github.com/ruby-amqp/hutch/pull/353)
184
+
185
+ ## 1.0.0 (April 8th, 2020)
186
+
187
+ Hutch has been around for several years. It is time to ship a 1.0. With it we try to correct
188
+ a few of overly opinionated decisions from recent releases. This means this release
189
+ contains potentially breaking changes.
190
+
191
+ ### Breaking Changes
192
+
193
+ * Hutch will no longer configure any queue type (such as [quorum queues](https://www.rabbitmq.com/quorum-queues.html))
194
+ or queue mode (used by classic [lazy queues](https://www.rabbitmq.com/lazy-queues.html))
195
+ by default as that can be breaking change for existing Hutch and RabbitMQ installations due to the
196
+ [property equivalence requirement](https://www.rabbitmq.com/queues.html#property-equivalence) in AMQP 0-9-1.
197
+
198
+ This means **some defaults introduced in `0.28.0` ([gocardless/hutch#341](https://github.com/gocardless/hutch/pull/341)) were reverted**.
199
+ The user has to opt in to configure the queue type and mode and other [optional arguments](https://www.rabbitmq.com/queues.html#optional-arguments) they need to use.
200
+ Most optional arguments can be set via [policies](https://www.rabbitmq.com/parameters.html#policies) which is always the recommended approach.
201
+ Queue type, unfortunately, is not one of them as different queue types have completely different
202
+ implementation details, on disk data formats and so on.
203
+
204
+ To use a quorum queue, use the `quorum_queue` consumer DSL method:
205
+
206
+ ``` ruby
207
+ class ConsumerUsingQuorumQueue
208
+ include Hutch::Consumer
209
+ consume 'hutch.test1'
210
+ # when in doubt, prefer using a policy to this DSL
211
+ # https://www.rabbitmq.com/parameters.html#policies
212
+ arguments 'x-key': :value
213
+
214
+ quorum_queue
215
+ end
216
+ ```
217
+
218
+ To use a classic lazy queue, use the `lazy_queue` consumer DSL method:
219
+
220
+ ``` ruby
221
+ class ConsumerUsingLazyQueue
222
+ include Hutch::Consumer
223
+ consume 'hutch.test1'
224
+ # when in doubt, prefer using a policy to this DSL
225
+ # https://www.rabbitmq.com/parameters.html#policies
226
+ arguments 'x-key': :value
227
+
228
+ lazy_queue
229
+ classic_queue
230
+ end
231
+ ```
232
+
233
+ By default Hutch will not configure any `x-queue-type` or `x-queue-mode` optional arguments
234
+ which is identical to RabbitMQ defaults (a regular classic queue).
235
+
236
+ Note that as of RabbitMQ 3.8.2, an omitted `x-queue-type` is [considered to be identical](https://github.com/rabbitmq/rabbitmq-common/issues/341)
237
+ to `x-queue-type` set to `classic` by RabbitMQ server.
238
+
239
+
240
+ #### Enhancements
241
+
242
+ * Exchange type is now configurable via the `mq_exchange_type` config setting. Supported exchanges must be
243
+ compatible with topic exchanges (e.g. wrap it). Default value is `topic`.
244
+
245
+ This feature is limited to topic and delayed message exchange plugins and is mostly
246
+ useful for forward compatibility.
247
+
248
+ Contributed by Michael Bumann.
249
+
250
+ GitHub issue: [gocardless/hutch#349](https://github.com/gocardless/hutch/pull/349)
251
+
252
+
253
+ ## 0.28.0 (March 17, 2020)
254
+
255
+ ### Enhancements
256
+
257
+ * Add lazy and quorum options for queues.
258
+
259
+ GitHub issue: [gocardless/hutch#341](https://github.com/gocardless/hutch/pull/341)
260
+
261
+ Contributed by: Arthur Del Esposte
262
+
263
+ * Log level in the message publisher switched to DEBUG.
264
+
265
+ GitHub issue: [gocardless/hutch#343](https://github.com/gocardless/hutch/pull/343)
266
+
267
+ Contributed by: Codruț Constantin Gușoi
268
+
269
+ ### Documentation
270
+
271
+ * Add zeitwerk note to README.
272
+
273
+ GitHub issue: [gocardless/hutch#342](https://github.com/gocardless/hutch/pull/342)
274
+
275
+ Contributed by: Paolo Zaccagnini
276
+
277
+ ### CI
278
+
279
+ * Use jruby-9.2.9.0
280
+
281
+ GitHub issue: [gocardless/hutch#336](https://github.com/gocardless/hutch/pull/336)
282
+
283
+ Contributed by: Olle Jonsson
284
+
285
+ ## 0.27.0 (September 9th, 2019)
286
+
287
+ ### Enhancements
288
+
289
+ * Error handler for Rollback.
290
+
291
+ GitHub issue: [gocardless/hutch#332](https://github.com/gocardless/hutch/pull/332)
292
+
293
+ Contributed by Johan Kok.
294
+
295
+ ### Bug Fixes
296
+
297
+ * Allow for the latest ActiveSupport version.
298
+
299
+ GitHub issue: [gocardless/hutch#334](https://github.com/gocardless/hutch/pull/334)
300
+
301
+ * Signal tests are now skipped on JRuby.
302
+
303
+ Contributed by Olle Jonsson.
304
+
305
+ GitHub issue: [gocardless/hutch#326](https://github.com/gocardless/hutch/pull/326)
306
+
307
+ ### Dependency Bumps
308
+
309
+ Bunny and other dependencies were updated to their latest release
310
+ series.
311
+
312
+
313
+ ## 0.26.0 (February 13th, 2019)
314
+
315
+ ### Dependency Bumps
316
+
317
+ Bunny and other dependencies were updated to their latest release
318
+ series.
319
+
320
+ ### Synchronized Connection Code
321
+
322
+ The methods that connect to RabbitMQ are now synchronized which makes
323
+ them safer to use in concurrent settings. Note that Hutch still
324
+ uses a single Bunny channel which is not meant to be shared
325
+ between threads without application-level synchronization for publishing.
326
+
327
+ Contributed by Chris Barton.
328
+
329
+ GitHub issue: [#308](https://github.com/gocardless/hutch/pull/308).
330
+
331
+ ### More Bunny Options Propagated
332
+
333
+ Contributed by Damian Le Nouaille.
334
+
335
+ GitHub issue: [#322](https://github.com/gocardless/hutch/pull/322).
336
+
337
+ ### Removed Opbeat Integration
338
+
339
+ The service is no longer generally available.
340
+
341
+ Contributed by Olle Jonsson.
342
+
343
+ GitHub issue: [#313](https://github.com/gocardless/hutch/pull/313)
344
+
345
+
346
+ ## 0.25.0 - January 17th, 2018
347
+
348
+ ### Consumer groups
349
+
350
+ Consumer groups allow you to run groups of consumers together, rather than running them
351
+ all at once in a single process. You define groups in your config file, and then specify
352
+ a `--only-group` option when starting up Hutch with `hutch`.
353
+
354
+ Contributed by Nickolai Smirnov.
355
+
356
+ GitHub pull request: [#296](https://github.com/gocardless/hutch/pull/296)
357
+
358
+ ### Fix configuring Hutch with a URI
359
+
360
+ When Hutch is configured to connect to RabbitMQ with a URI, we should respect the
361
+ `amqps` specification, defaulting to the standard protocol ports when not specified.
362
+
363
+ This means, for example, that `amqp://guest:guest@127.0.0.1/` connects to the server on
364
+ port 5672 and does not use TLS, whereas `amqps://guest:guest@127.0.0.1/` connects to the
365
+ server on port 5671 and uses TLS.
366
+
367
+ This behaviour was introduced in [#159](https://github.com/gocardless/hutch/pull/159) but
368
+ broken since then. This fixes it, and includes tests.
369
+
370
+ Contributed by Michael Canden-Lennox.
371
+
372
+ GitHub pull request: [#305](https://github.com/gocardless/hutch/pull/305)
373
+
374
+ ### Pass exceptions when setting up the client to configured error handlers
375
+
376
+ When an error occurs during Hutch's startup, it is currently not passed to the configured
377
+ error handlers. This starts handling those exceptions.
378
+
379
+ Contributed by Valentin Krasontovitsch.
380
+
381
+ GitHub issue: [#288](https://github.com/gocardless/hutch/issues/288)
382
+ GitHub pull request: [#301](https://github.com/gocardless/hutch/pull/301)
383
+
384
+ ### Log the Rails environment when running Hutch in verbose mode
385
+
386
+ When starting up Hutch in verbose mode with `hutch -v`, the Rails environment is now
387
+ logged.
388
+
389
+ Contributed by [@wppurking](https://github.com/wppurking).
390
+
391
+ GitHub pull request: [#282](https://github.com/gocardless/hutch/pull/282)
392
+
393
+ ### Make the Honeybadger error handler compatible with new versions of `honeybadger-ruby`
394
+
395
+ [`honeybadger-ruby`](https://github.com/honeybadger-io/honeybadger-ruby/)
396
+ [changed](https://github.com/honeybadger-io/honeybadger-ruby/blob/master/CHANGELOG.md#300---2017-02-06)
397
+ its API in v3.0.0. This updates our error handler to work with that, whilst still
398
+ maintaining our existing behaviour.
399
+
400
+ Contributed by Olle Jonsson and Bill Ruddock.
401
+
402
+ GitHub pull requests: [#274](https://github.com/gocardless/hutch/pull/274),
403
+ [#290](https://github.com/gocardless/hutch/pull/290)
6
404
 
7
405
  ## 0.24.0 — February 1st, 2017
8
406
 
@@ -20,7 +418,7 @@ Hutch will now handle several OS signals:
20
418
 
21
419
  * `USR2` will log stack traces of all alive VM threads
22
420
  * `QUIT` (except on JRuby), `INT`, `TERM` will cause Hutch daemon to shut down
23
-
421
+
24
422
  Contributed by Olle Jonsson.
25
423
 
26
424
  GitHub issues: [#263](https://github.com/gocardless/hutch/pull/263), [#271](https://github.com/gocardless/hutch/pull/271)
@@ -104,7 +502,7 @@ Contributed by Seamus Abshere.
104
502
 
105
503
  ### Worker: Log received messages using level DEBUG instead of INFO
106
504
 
107
- Received messages used to be logged using severity level INFO.
505
+ Received messages used to be logged using severity level INFO.
108
506
  This has been lowered to DEBUG.
109
507
 
110
508
  Contributed by Jesper Josefsson.
@@ -636,4 +1034,3 @@ Hutch.global_properties = proc {
636
1034
  ## 0.1.0 - September 9, 2013
637
1035
 
638
1036
  - Initial release
639
-
data/LICENSE CHANGED
@@ -1,4 +1,5 @@
1
1
  Copyright (c) 2013-2016 GoCardless
2
+ Copyright (c) 2016-2026 Hutch contributors
2
3
 
3
4
  Permission is hereby granted, free of charge, to any person
4
5
  obtaining a copy of this software and associated documentation