shivam 0.0.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/test.yml +57 -0
- data/.gitignore +10 -0
- data/.rspec +1 -0
- data/.yardopts +5 -0
- data/CHANGELOG.md +899 -0
- data/Gemfile +35 -0
- data/Guardfile +14 -0
- data/LICENSE +23 -0
- data/README.md +679 -0
- data/Rakefile +21 -0
- data/bin/ci/before_build.sh +20 -0
- data/bin/ci/before_build_docker.sh +20 -0
- data/bin/ci/install_on_debian.sh +46 -0
- data/bin/hutch +8 -0
- data/examples/consumer.rb +13 -0
- data/examples/producer.rb +10 -0
- data/hutch.gemspec +27 -0
- data/lib/hutch/acknowledgements/base.rb +16 -0
- data/lib/hutch/acknowledgements/nack_on_all_failures.rb +19 -0
- data/lib/hutch/adapter.rb +11 -0
- data/lib/hutch/adapters/bunny.rb +37 -0
- data/lib/hutch/adapters/march_hare.rb +41 -0
- data/lib/hutch/broker.rb +384 -0
- data/lib/hutch/cli.rb +246 -0
- data/lib/hutch/config.rb +305 -0
- data/lib/hutch/consumer.rb +125 -0
- data/lib/hutch/error_handlers/airbrake.rb +54 -0
- data/lib/hutch/error_handlers/base.rb +15 -0
- data/lib/hutch/error_handlers/bugsnag.rb +30 -0
- data/lib/hutch/error_handlers/honeybadger.rb +43 -0
- data/lib/hutch/error_handlers/logger.rb +22 -0
- data/lib/hutch/error_handlers/rollbar.rb +28 -0
- data/lib/hutch/error_handlers/sentry.rb +26 -0
- data/lib/hutch/error_handlers/sentry_raven.rb +31 -0
- data/lib/hutch/error_handlers.rb +11 -0
- data/lib/hutch/exceptions.rb +14 -0
- data/lib/hutch/logging.rb +32 -0
- data/lib/hutch/message.rb +31 -0
- data/lib/hutch/publisher.rb +75 -0
- data/lib/hutch/serializers/identity.rb +19 -0
- data/lib/hutch/serializers/json.rb +22 -0
- data/lib/hutch/tracers/datadog.rb +18 -0
- data/lib/hutch/tracers/newrelic.rb +19 -0
- data/lib/hutch/tracers/null_tracer.rb +15 -0
- data/lib/hutch/tracers.rb +7 -0
- data/lib/hutch/version.rb +3 -0
- data/lib/hutch/waiter.rb +104 -0
- data/lib/hutch/worker.rb +145 -0
- data/lib/hutch.rb +69 -0
- data/lib/yard-settings/handler.rb +38 -0
- data/lib/yard-settings/yard-settings.rb +2 -0
- data/spec/hutch/broker_spec.rb +462 -0
- data/spec/hutch/cli_spec.rb +93 -0
- data/spec/hutch/config_spec.rb +259 -0
- data/spec/hutch/consumer_spec.rb +208 -0
- data/spec/hutch/error_handlers/airbrake_spec.rb +49 -0
- data/spec/hutch/error_handlers/bugsnag_spec.rb +55 -0
- data/spec/hutch/error_handlers/honeybadger_spec.rb +58 -0
- data/spec/hutch/error_handlers/logger_spec.rb +28 -0
- data/spec/hutch/error_handlers/rollbar_spec.rb +45 -0
- data/spec/hutch/error_handlers/sentry_raven_spec.rb +37 -0
- data/spec/hutch/error_handlers/sentry_spec.rb +47 -0
- data/spec/hutch/logger_spec.rb +34 -0
- data/spec/hutch/message_spec.rb +38 -0
- data/spec/hutch/serializers/json_spec.rb +17 -0
- data/spec/hutch/tracers/datadog_spec.rb +44 -0
- data/spec/hutch/waiter_spec.rb +51 -0
- data/spec/hutch/worker_spec.rb +184 -0
- data/spec/hutch_spec.rb +87 -0
- data/spec/spec_helper.rb +42 -0
- data/templates/default/class/html/settings.erb +0 -0
- data/templates/default/class/setup.rb +4 -0
- data/templates/default/fulldoc/html/css/hutch.css +13 -0
- data/templates/default/layout/html/setup.rb +7 -0
- data/templates/default/method_details/html/settings.erb +5 -0
- data/templates/default/method_details/setup.rb +4 -0
- data/templates/default/method_details/text/settings.erb +0 -0
- data/templates/default/module/html/settings.erb +40 -0
- data/templates/default/module/setup.rb +4 -0
- metadata +205 -0
data/CHANGELOG.md
ADDED
@@ -0,0 +1,899 @@
|
|
1
|
+
## 1.1.1 (March 18th, 2022)
|
2
|
+
### Dependency Bump
|
3
|
+
|
4
|
+
Hutch now allows ActiveSupport 7.x.
|
5
|
+
|
6
|
+
|
7
|
+
## 1.1.0 (July 26th, 2021)
|
8
|
+
|
9
|
+
### Bugsnag Error Handler
|
10
|
+
|
11
|
+
Contributed by @ivanhuang1.
|
12
|
+
|
13
|
+
GitHub issue: [#362](https://github.com/ruby-amqp/hutch/pull/362)
|
14
|
+
|
15
|
+
### Datadog Tracer
|
16
|
+
|
17
|
+
Contributed by Karol @Azdaroth Galanciak.
|
18
|
+
|
19
|
+
GitHub issue: [#360](https://github.com/ruby-amqp/hutch/pull/360)
|
20
|
+
|
21
|
+
### Updated Sentry Error Handler
|
22
|
+
|
23
|
+
Contributed by Karol @Azdaroth Galanciak.
|
24
|
+
|
25
|
+
GitHub issue: [#363](https://github.com/ruby-amqp/hutch/pull/363)
|
26
|
+
|
27
|
+
### Type Casting for Values Set Using Hutch::Config.set
|
28
|
+
|
29
|
+
Values set with `Hutch::Config.set` now have expected setting type casting
|
30
|
+
applied to them.
|
31
|
+
|
32
|
+
Contributed by Karol @Azdaroth Galanciak.
|
33
|
+
|
34
|
+
GitHub issue: [#358](https://github.com/ruby-amqp/hutch/pull/358)
|
35
|
+
|
36
|
+
### Wider MultiJson Adoption
|
37
|
+
|
38
|
+
Contributed by Ulysse @BuonOmo Buonomo.
|
39
|
+
|
40
|
+
GitHub issue: [#356](https://github.com/ruby-amqp/hutch/pull/356)
|
41
|
+
|
42
|
+
### README Corrections
|
43
|
+
|
44
|
+
Contributed by Johan @johankok Kok.
|
45
|
+
|
46
|
+
GitHub issue: [#353](https://github.com/ruby-amqp/hutch/pull/353)
|
47
|
+
|
48
|
+
## 1.0.0 (April 8th, 2020)
|
49
|
+
|
50
|
+
Hutch has been around for several years. It is time to ship a 1.0. With it we try to correct
|
51
|
+
a few of overly opinionated decisions from recent releases. This means this release
|
52
|
+
contains potentially breaking changes.
|
53
|
+
|
54
|
+
### Breaking Changes
|
55
|
+
|
56
|
+
* Hutch will no longer configure any queue type (such as [quorum queues](https://www.rabbitmq.com/quorum-queues.html))
|
57
|
+
or queue mode (used by classic [lazy queues](https://www.rabbitmq.com/lazy-queues.html))
|
58
|
+
by default as that can be breaking change for existing Hutch and RabbitMQ installations due to the
|
59
|
+
[property equivalence requirement](https://www.rabbitmq.com/queues.html#property-equivalence) in AMQP 0-9-1.
|
60
|
+
|
61
|
+
This means **some defaults introduced in `0.28.0` ([gocardless/hutch#341](https://github.com/gocardless/hutch/pull/341)) were reverted**.
|
62
|
+
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.
|
63
|
+
Most optional arguments can be set via [policies](https://www.rabbitmq.com/parameters.html#policies) which is always the recommended approach.
|
64
|
+
Queue type, unfortunately, is not one of them as different queue types have completely different
|
65
|
+
implementation details, on disk data formats and so on.
|
66
|
+
|
67
|
+
To use a quorum queue, use the `quorum_queue` consumer DSL method:
|
68
|
+
|
69
|
+
``` ruby
|
70
|
+
class ConsumerUsingQuorumQueue
|
71
|
+
include Hutch::Consumer
|
72
|
+
consume 'hutch.test1'
|
73
|
+
# when in doubt, prefer using a policy to this DSL
|
74
|
+
# https://www.rabbitmq.com/parameters.html#policies
|
75
|
+
arguments 'x-key': :value
|
76
|
+
|
77
|
+
quorum_queue
|
78
|
+
end
|
79
|
+
```
|
80
|
+
|
81
|
+
To use a classic lazy queue, use the `lazy_queue` consumer DSL method:
|
82
|
+
|
83
|
+
``` ruby
|
84
|
+
class ConsumerUsingLazyQueue
|
85
|
+
include Hutch::Consumer
|
86
|
+
consume 'hutch.test1'
|
87
|
+
# when in doubt, prefer using a policy to this DSL
|
88
|
+
# https://www.rabbitmq.com/parameters.html#policies
|
89
|
+
arguments 'x-key': :value
|
90
|
+
|
91
|
+
lazy_queue
|
92
|
+
classic_queue
|
93
|
+
end
|
94
|
+
```
|
95
|
+
|
96
|
+
By default Hutch will not configure any `x-queue-type` or `x-queue-mode` optional arguments
|
97
|
+
which is identical to RabbitMQ defaults (a regular classic queue).
|
98
|
+
|
99
|
+
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)
|
100
|
+
to `x-queue-type` set to `classic` by RabbitMQ server.
|
101
|
+
|
102
|
+
|
103
|
+
#### Enhancements
|
104
|
+
|
105
|
+
* Exchange type is now configurable via the `mq_exchange_type` config setting. Supported exchanges must be
|
106
|
+
compatible with topic exchanges (e.g. wrap it). Default value is `topic`.
|
107
|
+
|
108
|
+
This feature is limited to topic and delayed message exchange plugins and is mostly
|
109
|
+
useful for forward compatibility.
|
110
|
+
|
111
|
+
Contributed by Michael Bumann.
|
112
|
+
|
113
|
+
GitHub issue: [gocardless/hutch#349](https://github.com/gocardless/hutch/pull/349)
|
114
|
+
|
115
|
+
|
116
|
+
## 0.28.0 (March 17, 2020)
|
117
|
+
|
118
|
+
### Enhancements
|
119
|
+
|
120
|
+
* Add lazy and quorum options for queues.
|
121
|
+
|
122
|
+
GitHub issue: [gocardless/hutch#341](https://github.com/gocardless/hutch/pull/341)
|
123
|
+
|
124
|
+
Contributed by: Arthur Del Esposte
|
125
|
+
|
126
|
+
* Log level in the message publisher switched to DEBUG.
|
127
|
+
|
128
|
+
GitHub issue: [gocardless/hutch#343](https://github.com/gocardless/hutch/pull/343)
|
129
|
+
|
130
|
+
Contributed by: Codruț Constantin Gușoi
|
131
|
+
|
132
|
+
### Documentation
|
133
|
+
|
134
|
+
* Add zeitwerk note to README.
|
135
|
+
|
136
|
+
GitHub issue: [gocardless/hutch#342](https://github.com/gocardless/hutch/pull/342)
|
137
|
+
|
138
|
+
Contributed by: Paolo Zaccagnini
|
139
|
+
|
140
|
+
### CI
|
141
|
+
|
142
|
+
* Use jruby-9.2.9.0
|
143
|
+
|
144
|
+
GitHub issue: [gocardless/hutch#336](https://github.com/gocardless/hutch/pull/336)
|
145
|
+
|
146
|
+
Contributed by: Olle Jonsson
|
147
|
+
|
148
|
+
## 0.27.0 (September 9th, 2019)
|
149
|
+
|
150
|
+
### Enhancements
|
151
|
+
|
152
|
+
* Error handler for Rollback.
|
153
|
+
|
154
|
+
GitHub issue: [gocardless/hutch#332](https://github.com/gocardless/hutch/pull/332)
|
155
|
+
|
156
|
+
Contributed by Johan Kok.
|
157
|
+
|
158
|
+
### Bug Fixes
|
159
|
+
|
160
|
+
* Allow for the latest ActiveSupport version.
|
161
|
+
|
162
|
+
GitHub issue: [gocardless/hutch#334](https://github.com/gocardless/hutch/pull/334)
|
163
|
+
|
164
|
+
* Signal tests are now skipped on JRuby.
|
165
|
+
|
166
|
+
Contributed by Olle Jonsson.
|
167
|
+
|
168
|
+
GitHub issue: [gocardless/hutch#326](https://github.com/gocardless/hutch/pull/326)
|
169
|
+
|
170
|
+
### Dependency Bumps
|
171
|
+
|
172
|
+
Bunny and other dependencies were updated to their latest release
|
173
|
+
series.
|
174
|
+
|
175
|
+
|
176
|
+
## 0.26.0 (February 13th, 2019)
|
177
|
+
|
178
|
+
### Dependency Bumps
|
179
|
+
|
180
|
+
Bunny and other dependencies were updated to their latest release
|
181
|
+
series.
|
182
|
+
|
183
|
+
### Synchronized Connection Code
|
184
|
+
|
185
|
+
The methods that connect to RabbitMQ are now synchronized which makes
|
186
|
+
them safer to use in concurrent settings. Note that Hutch still
|
187
|
+
uses a single Bunny channel which is not meant to be shared
|
188
|
+
between threads without application-level synchronization for publishing.
|
189
|
+
|
190
|
+
Contributed by Chris Barton.
|
191
|
+
|
192
|
+
GitHub issue: [#308](https://github.com/gocardless/hutch/pull/308).
|
193
|
+
|
194
|
+
### More Bunny Options Propagated
|
195
|
+
|
196
|
+
Contributed by Damian Le Nouaille.
|
197
|
+
|
198
|
+
GitHub issue: [#322](https://github.com/gocardless/hutch/pull/322).
|
199
|
+
|
200
|
+
### Removed Opbeat Integration
|
201
|
+
|
202
|
+
The service is no longer generally available.
|
203
|
+
|
204
|
+
Contributed by Olle Jonsson.
|
205
|
+
|
206
|
+
GitHub issue: [#313](https://github.com/gocardless/hutch/pull/313)
|
207
|
+
|
208
|
+
|
209
|
+
## 0.25.0 - January 17th, 2018
|
210
|
+
|
211
|
+
### Consumer groups
|
212
|
+
|
213
|
+
Consumer groups allow you to run groups of consumers together, rather than running them
|
214
|
+
all at once in a single process. You define groups in your config file, and then specify
|
215
|
+
a `--only-group` option when starting up Hutch with `hutch`.
|
216
|
+
|
217
|
+
Contributed by Nickolai Smirnov.
|
218
|
+
|
219
|
+
GitHub pull request: [#296](https://github.com/gocardless/hutch/pull/296)
|
220
|
+
|
221
|
+
### Fix configuring Hutch with a URI
|
222
|
+
|
223
|
+
When Hutch is configured to connect to RabbitMQ with a URI, we should respect the
|
224
|
+
`amqps` specification, defaulting to the standard protocol ports when not specified.
|
225
|
+
|
226
|
+
This means, for example, that `amqp://guest:guest@127.0.0.1/` connects to the server on
|
227
|
+
port 5672 and does not use TLS, whereas `amqps://guest:guest@127.0.0.1/` connects to the
|
228
|
+
server on port 5671 and uses TLS.
|
229
|
+
|
230
|
+
This behaviour was introduced in [#159](https://github.com/gocardless/hutch/pull/159) but
|
231
|
+
broken since then. This fixes it, and includes tests.
|
232
|
+
|
233
|
+
Contributed by Michael Canden-Lennox.
|
234
|
+
|
235
|
+
GitHub pull request: [#305](https://github.com/gocardless/hutch/pull/305)
|
236
|
+
|
237
|
+
### Pass exceptions when setting up the client to configured error handlers
|
238
|
+
|
239
|
+
When an error occurs during Hutch's startup, it is currently not passed to the configured
|
240
|
+
error handlers. This starts handling those exceptions.
|
241
|
+
|
242
|
+
Contributed by Valentin Krasontovitsch.
|
243
|
+
|
244
|
+
GitHub issue: [#288](https://github.com/gocardless/hutch/issues/288)
|
245
|
+
GitHub pull request: [#301](https://github.com/gocardless/hutch/pull/301)
|
246
|
+
|
247
|
+
### Log the Rails environment when running Hutch in verbose mode
|
248
|
+
|
249
|
+
When starting up Hutch in verbose mode with `hutch -v`, the Rails environment is now
|
250
|
+
logged.
|
251
|
+
|
252
|
+
Contributed by [@wppurking](https://github.com/wppurking).
|
253
|
+
|
254
|
+
GitHub pull request: [#282](https://github.com/gocardless/hutch/pull/282)
|
255
|
+
|
256
|
+
### Make the Honeybadger error handler compatible with new versions of `honeybadger-ruby`
|
257
|
+
|
258
|
+
[`honeybadger-ruby`](https://github.com/honeybadger-io/honeybadger-ruby/)
|
259
|
+
[changed](https://github.com/honeybadger-io/honeybadger-ruby/blob/master/CHANGELOG.md#300---2017-02-06)
|
260
|
+
its API in v3.0.0. This updates our error handler to work with that, whilst still
|
261
|
+
maintaining our existing behaviour.
|
262
|
+
|
263
|
+
Contributed by Olle Jonsson and Bill Ruddock.
|
264
|
+
|
265
|
+
GitHub pull requests: [#274](https://github.com/gocardless/hutch/pull/274),
|
266
|
+
[#290](https://github.com/gocardless/hutch/pull/290)
|
267
|
+
|
268
|
+
## 0.24.0 — February 1st, 2017
|
269
|
+
|
270
|
+
### Configurable Consumer Prefixes
|
271
|
+
|
272
|
+
Hutch consumers now can use user-provided prefixes for consumer tags.
|
273
|
+
|
274
|
+
Contributed by Dávid Lantos.
|
275
|
+
|
276
|
+
GitHub issue: [#265](https://github.com/gocardless/hutch/pull/265)
|
277
|
+
|
278
|
+
### Signal Handling in Workers
|
279
|
+
|
280
|
+
Hutch will now handle several OS signals:
|
281
|
+
|
282
|
+
* `USR2` will log stack traces of all alive VM threads
|
283
|
+
* `QUIT` (except on JRuby), `INT`, `TERM` will cause Hutch daemon to shut down
|
284
|
+
|
285
|
+
Contributed by Olle Jonsson.
|
286
|
+
|
287
|
+
GitHub issues: [#263](https://github.com/gocardless/hutch/pull/263), [#271](https://github.com/gocardless/hutch/pull/271)
|
288
|
+
|
289
|
+
### Opbeat Tracer
|
290
|
+
|
291
|
+
Hutch now provides a tracer implementation for [Opbeat](https://opbeat.com/).
|
292
|
+
|
293
|
+
Contributed by Olle Jonsson.
|
294
|
+
|
295
|
+
GitHub issue: [#262](https://github.com/gocardless/hutch/pull/262)
|
296
|
+
|
297
|
+
### `HUTCH_URI` Support
|
298
|
+
|
299
|
+
The `HUTCH_URI` environment variable now can be used to configure
|
300
|
+
Hutch connection URI.
|
301
|
+
|
302
|
+
Contributed by Sam Stickland.
|
303
|
+
|
304
|
+
GitHub issue: [#270](https://github.com/gocardless/hutch/pull/270)
|
305
|
+
|
306
|
+
|
307
|
+
## 0.23.1 — October 20th, 2016
|
308
|
+
|
309
|
+
This release contains a **breaking change** in the error
|
310
|
+
handlers interface.
|
311
|
+
|
312
|
+
### All Message Properties Passed to Error Handlers
|
313
|
+
|
314
|
+
Previously error handlers were provided a message ID as first
|
315
|
+
argument to `ErrorHandler#handle`. Now it is a hash of all message
|
316
|
+
properties.
|
317
|
+
|
318
|
+
This is a **breaking public API change**. If you do not use custom
|
319
|
+
error handlers, you are not affected.
|
320
|
+
|
321
|
+
Contributed by Pierre-Louis Gottfrois.
|
322
|
+
|
323
|
+
GH issue: [hutch#238](https://github.com/gocardless/hutch/pull/238)
|
324
|
+
|
325
|
+
### Opbeat Error Handler
|
326
|
+
|
327
|
+
Contributed by Olle Jonsson.
|
328
|
+
|
329
|
+
|
330
|
+
## 0.22.1 — June 7th, 2016
|
331
|
+
|
332
|
+
### Message Payload is Reported to Sentry
|
333
|
+
|
334
|
+
Contributed by Matt Thompson.
|
335
|
+
|
336
|
+
### Daemonization Flag Ignored on JRuby
|
337
|
+
|
338
|
+
Hutch will no longer try to daemonize its process on JRuby
|
339
|
+
(since it is not supported) and will emit a warning instead.
|
340
|
+
|
341
|
+
Contributed by Olle Jonsson.
|
342
|
+
|
343
|
+
### Custom Setup Steps in Hutch::Worker
|
344
|
+
|
345
|
+
`Hutch::Worker` now accepts a list of callables that are invoked
|
346
|
+
after queue setup.
|
347
|
+
|
348
|
+
Contributed by Kelly Stannard.
|
349
|
+
|
350
|
+
### More Flexible and Better Abstracted Hutch::Broker
|
351
|
+
|
352
|
+
`Hutch::Broker` was refactored with some bits extracted into separate
|
353
|
+
classes or methods, making them easier to override.
|
354
|
+
|
355
|
+
Contributed by Aleksandar Ivanov and Ryan Hosford.
|
356
|
+
|
357
|
+
### Configurable Consumer Thread Pool Exception Handling (MRI only)
|
358
|
+
|
359
|
+
`:consumer_pool_abort_on_exception` is a new option
|
360
|
+
(defaults to `false`) which defines whether Bunny's
|
361
|
+
consumer work pool threads should abort on exception.
|
362
|
+
The option is ignored on JRuby.
|
363
|
+
|
364
|
+
Contributed by Seamus Abshere.
|
365
|
+
|
366
|
+
### Worker: Log received messages using level DEBUG instead of INFO
|
367
|
+
|
368
|
+
Received messages used to be logged using severity level INFO.
|
369
|
+
This has been lowered to DEBUG.
|
370
|
+
|
371
|
+
Contributed by Jesper Josefsson.
|
372
|
+
|
373
|
+
### Refactoring
|
374
|
+
|
375
|
+
Olle Jonsson and Kelly Stannard have contributed
|
376
|
+
multiple internal improvements that have no behaviour changes.
|
377
|
+
|
378
|
+
|
379
|
+
## 0.21.0 — February 7th, 2016
|
380
|
+
|
381
|
+
### JRuby Compatibility Restored
|
382
|
+
|
383
|
+
Contributed by Jesper Josefsson.
|
384
|
+
|
385
|
+
### More Reliable Rails app Detection
|
386
|
+
|
387
|
+
Rails application detection now won't produce false positives
|
388
|
+
for applications that include `config/environment.rb`. Instead,
|
389
|
+
`bin/rails` and `script/rails` are used.
|
390
|
+
|
391
|
+
Contributed by @bisusubedi.
|
392
|
+
|
393
|
+
### Refactoring
|
394
|
+
|
395
|
+
Contributed by Jesper Josefsson and Olle Jonsson.
|
396
|
+
|
397
|
+
|
398
|
+
## 0.20.0 — November 16th, 2015
|
399
|
+
|
400
|
+
### Hutch::Exception includes Bunny::Exception
|
401
|
+
|
402
|
+
`Hutch::Exception` now inherits from `Bunny::Exception` which
|
403
|
+
inherits from `StandardError`.
|
404
|
+
|
405
|
+
GH issue: [#137](https://github.com/gocardless/hutch/issues/137).
|
406
|
+
|
407
|
+
|
408
|
+
### Pluggable (Negative) Acknowledge Handlers
|
409
|
+
|
410
|
+
Hutch now can be configured to use a user-provided
|
411
|
+
object(s) to perform acknowledgement on consumer exceptions.
|
412
|
+
|
413
|
+
For example, this is what the default handler looks like:
|
414
|
+
|
415
|
+
``` ruby
|
416
|
+
require 'hutch/logging'
|
417
|
+
require 'hutch/acknowledgements/base'
|
418
|
+
|
419
|
+
module Hutch
|
420
|
+
module Acknowledgements
|
421
|
+
class NackOnAllFailures < Base
|
422
|
+
include Logging
|
423
|
+
|
424
|
+
def handle(delivery_info, properties, broker, ex)
|
425
|
+
prefix = "message(#{properties.message_id || '-'}): "
|
426
|
+
logger.debug "#{prefix} nacking message"
|
427
|
+
|
428
|
+
broker.nack(delivery_info.delivery_tag)
|
429
|
+
|
430
|
+
# terminates further chain processing
|
431
|
+
true
|
432
|
+
end
|
433
|
+
end
|
434
|
+
end
|
435
|
+
end
|
436
|
+
```
|
437
|
+
|
438
|
+
Handlers are configured similarly to exception notification handlers,
|
439
|
+
via `:error_acknowledgements` in Hutch config.
|
440
|
+
|
441
|
+
Contributed by Derek Kastner.
|
442
|
+
|
443
|
+
GH issue: [#177](https://github.com/gocardless/hutch/pull/177).
|
444
|
+
|
445
|
+
|
446
|
+
### Configurable Exchange Properties
|
447
|
+
|
448
|
+
`:mq_exchange_options` is a new config option that can be used
|
449
|
+
to provide a hash of exchange attributes (durable, auto-delete).
|
450
|
+
The options will be passed directly to Bunny (or March Hare, when
|
451
|
+
running on JRuby).
|
452
|
+
|
453
|
+
Contributed by Derek Kastner.
|
454
|
+
|
455
|
+
GH issue: [#170](https://github.com/gocardless/hutch/pull/170).
|
456
|
+
|
457
|
+
|
458
|
+
### Bunny Update
|
459
|
+
|
460
|
+
Bunny is updated to 2.2.1.
|
461
|
+
|
462
|
+
|
463
|
+
## 0.19.0 — September 7th, 2015
|
464
|
+
|
465
|
+
### Pluggable Serialisers
|
466
|
+
|
467
|
+
Hutch now supports pluggable serialisers: see `Hutch::Serializer::JSON` for
|
468
|
+
an example. Serialiser is configured via Hutch config as a Ruby
|
469
|
+
class.
|
470
|
+
|
471
|
+
Contributed by Dmitry Galinsky.
|
472
|
+
|
473
|
+
|
474
|
+
### multi_json Update
|
475
|
+
|
476
|
+
Hutch now depends on multi_json `1.11.x`.
|
477
|
+
|
478
|
+
### Bunny Update
|
479
|
+
|
480
|
+
Bunny is updated to [2.2.0](http://blog.rubyrabbitmq.info/blog/2015/09/06/bunny-2-dot-2-0-is-released/).
|
481
|
+
|
482
|
+
### More Bunny SSL Options
|
483
|
+
|
484
|
+
`:mq_tls_ca_certificates` and `:mq_verify_peer` options will now be passed on to Bunny as `:tls_ca_certificates` and `:verify_peer` respectively.
|
485
|
+
|
486
|
+
Contributed by Kennon Ballou.
|
487
|
+
|
488
|
+
## 0.18.0 — August 16th, 2015
|
489
|
+
|
490
|
+
### JRuby Support (Using March Hare)
|
491
|
+
|
492
|
+
Hutch will now use March Hare when running on JRuby.
|
493
|
+
This will yield significant throughput and core utilisation
|
494
|
+
improvements for workloads with many and/or busy consumers.
|
495
|
+
|
496
|
+
Contributed by Teodor Pripoae.
|
497
|
+
|
498
|
+
|
499
|
+
### Configurable Consumer Thread Pool Size
|
500
|
+
|
501
|
+
`:consumer_pool_size` is a new option (defaults to `1`) which defines
|
502
|
+
Bunny consumer work pool size.
|
503
|
+
|
504
|
+
Contributed by Derek Kastner.
|
505
|
+
|
506
|
+
### Bunny Logger Option
|
507
|
+
|
508
|
+
`:client_logger` is a new option that allows
|
509
|
+
for configuring loggerd used by Bunny, the underlying
|
510
|
+
RabbitMQ client library.
|
511
|
+
|
512
|
+
Contributed by Nate Salisbury.
|
513
|
+
|
514
|
+
|
515
|
+
## 0.17.0 — July 19th, 2015
|
516
|
+
|
517
|
+
Fixes an issue with `NoMethodError` in `Hutch::Config`.
|
518
|
+
|
519
|
+
|
520
|
+
## 0.16.0 — July 19th, 2015
|
521
|
+
|
522
|
+
### Support amqps URIs
|
523
|
+
|
524
|
+
Hutch now automatically enables TLS and changes default port
|
525
|
+
when URI scheme is `amqps`.
|
526
|
+
|
527
|
+
Contributed by Carl Hörberg.
|
528
|
+
|
529
|
+
### Hash With Indifferent Access
|
530
|
+
|
531
|
+
Hutch now uses `HashWithIndifferentAccess` internally
|
532
|
+
to reduce use of symbols (which are not garbage collected
|
533
|
+
by widely used Ruby versions).
|
534
|
+
|
535
|
+
Contributed by Teodor Pripoae.
|
536
|
+
|
537
|
+
|
538
|
+
## 0.15.0 — May 5th, 2015
|
539
|
+
|
540
|
+
### Airbrake Error Handler
|
541
|
+
|
542
|
+
Contributed by Nate Salisbury.
|
543
|
+
|
544
|
+
### Ruby 1.9 Support Dropped
|
545
|
+
|
546
|
+
Ruby 1.9 is no longer supported by Hutch (and soon Bunny 2.0).
|
547
|
+
1.9 is also no longer maintained by the Ruby core team.
|
548
|
+
|
549
|
+
### Custom Arguments per Consumers
|
550
|
+
|
551
|
+
Allow to set custom arguments per consumers by using the `arguments` setter.
|
552
|
+
Arguments are usually used by rabbitmq plugins or to set queue policies. You can
|
553
|
+
find a list of supported arguments [here](https://www.rabbitmq.com/extensions.html).
|
554
|
+
|
555
|
+
Contributed by Pierre-Louis Gottfrois.
|
556
|
+
|
557
|
+
### Message Processing Tracers
|
558
|
+
|
559
|
+
Allow to track message processing by using the `:tracer` config option,
|
560
|
+
the value should be a class (or fully-qualified string name of a class) that
|
561
|
+
implements the tracing interface.
|
562
|
+
|
563
|
+
A tracer that performs NewRelic instrumentation ships with Hutch
|
564
|
+
and requires New Relic gem to be loaded.
|
565
|
+
|
566
|
+
Contributed by Mirosław Nagaś.
|
567
|
+
|
568
|
+
### Added Logger Method to Consumer Module
|
569
|
+
|
570
|
+
Consumers can now call a logger method to write to Hutch's log.
|
571
|
+
|
572
|
+
Contributed by Matty Courtney
|
573
|
+
|
574
|
+
## 0.14.0 — Feb 23rd, 2015
|
575
|
+
|
576
|
+
### Configurable Socket Timeouts
|
577
|
+
|
578
|
+
Socket read and write timeouts are now configurable using
|
579
|
+
the `read_timeout` and `write_timeout` options, respectively.
|
580
|
+
|
581
|
+
Contributed by Chris Barton.
|
582
|
+
|
583
|
+
|
584
|
+
### Logged Messages as Serialised as JSON
|
585
|
+
|
586
|
+
...as opposed to Ruby object printing.
|
587
|
+
|
588
|
+
Contributed by Andrew Morton.
|
589
|
+
|
590
|
+
|
591
|
+
### Configurable Heartbeat
|
592
|
+
|
593
|
+
Config now supports a new option: `:heartbeat`, which is passed
|
594
|
+
on to Bunny.
|
595
|
+
|
596
|
+
Contributed by Simon Taranto.
|
597
|
+
|
598
|
+
|
599
|
+
### HoneyBadger Error Handler
|
600
|
+
|
601
|
+
Contributed by Daniel Farrell.
|
602
|
+
|
603
|
+
|
604
|
+
### Hutch.connected? Now Returns Up-to-Date Value
|
605
|
+
|
606
|
+
`Hutch.connected?` no longer relies on an ivar and always returns
|
607
|
+
an up-to-date value.
|
608
|
+
|
609
|
+
Contributed by Pierre-Louis Gottfrois.
|
610
|
+
|
611
|
+
|
612
|
+
## 0.13.0 — Dec 5th, 2014
|
613
|
+
|
614
|
+
### HTTP API Can Be Disabled for Consumers
|
615
|
+
|
616
|
+
HTTP API use can be disabled for consumers using the `:enable_http_api_use` config
|
617
|
+
option (defaults to true).
|
618
|
+
|
619
|
+
|
620
|
+
|
621
|
+
## 0.12.0 — Nov 25th, 2014
|
622
|
+
|
623
|
+
### Explicit Requires
|
624
|
+
|
625
|
+
Hutch no longer relies on `Kernel#autoload` to load its key
|
626
|
+
modules and classes.
|
627
|
+
|
628
|
+
Contributed by Pierre-Louis Gottfrois.
|
629
|
+
|
630
|
+
|
631
|
+
### hutch --version No Longer Fails
|
632
|
+
|
633
|
+
```
|
634
|
+
hutch --version
|
635
|
+
```
|
636
|
+
|
637
|
+
no longer fails with an exception.
|
638
|
+
|
639
|
+
Contributed by Olle Jonsson.
|
640
|
+
|
641
|
+
|
642
|
+
### Base Class for All Hutch Exceptions
|
643
|
+
|
644
|
+
All Hutch exceptions now inherit from `Hutch::Exception`.
|
645
|
+
|
646
|
+
Contributed by Pierre-Louis Gottfrois.
|
647
|
+
|
648
|
+
|
649
|
+
## 0.11.0 — Nov 14th, 2014
|
650
|
+
|
651
|
+
### Publisher Confirms Support
|
652
|
+
|
653
|
+
`:force_publisher_confirms` is a new configuration option that forces `Hutch.publish` to wait
|
654
|
+
for a confirm for every message published. Note that this **will cause a significant drop in throughput**:
|
655
|
+
|
656
|
+
``` ruby
|
657
|
+
Hutch::Config.set(:force_publisher_confirms, true)
|
658
|
+
```
|
659
|
+
|
660
|
+
`Hutch::Broker#confirm_select` and `Hutch::Broker#wait_for_confirms` are new public API methods
|
661
|
+
that delegate to their respective `Bunny::Channel` counterparts. `Hutch::Broker#confirm_select`
|
662
|
+
can be used to handle confirms with a callback instead of waiting:
|
663
|
+
|
664
|
+
``` ruby
|
665
|
+
broker.confirm_select do |delivery_tag, multiple, nack|
|
666
|
+
# ...
|
667
|
+
end
|
668
|
+
```
|
669
|
+
|
670
|
+
|
671
|
+
### Bunny Update
|
672
|
+
|
673
|
+
Bunny is updated to [1.6.0](http://blog.rubyrabbitmq.info/blog/2014/10/31/bunny-1-dot-6-0-is-released/).
|
674
|
+
|
675
|
+
|
676
|
+
## 0.10.0 — Oct 22, 2014
|
677
|
+
|
678
|
+
### Configuration via URI
|
679
|
+
|
680
|
+
Hutch now supports a new configuration key, `:uri`, which allows
|
681
|
+
connection configuration via a URI.
|
682
|
+
|
683
|
+
Note that since the URI has to include credentials, this option
|
684
|
+
is not available on the command line.
|
685
|
+
|
686
|
+
### Bunny Update
|
687
|
+
|
688
|
+
Bunny is updated to `1.5.1`, which mitigates the POODLE attack
|
689
|
+
by disabling SSL 3.0 where possible.
|
690
|
+
|
691
|
+
### Payload in Error Handlers
|
692
|
+
|
693
|
+
Error handlers will now have access to message payload.
|
694
|
+
|
695
|
+
Contributed by Daniel Farrell.
|
696
|
+
|
697
|
+
### Exceptions in Error Handlers Don't Prevent Nacks
|
698
|
+
|
699
|
+
Exceptions in error handlers no longer prevent messages from being
|
700
|
+
`basic.nack`-ed.
|
701
|
+
|
702
|
+
### Pid File Support
|
703
|
+
|
704
|
+
`:pidfile` is a new configuration option that stores Hutch process
|
705
|
+
PID in a file at provided path.
|
706
|
+
|
707
|
+
Contributed by Rustam Sharshenov.
|
708
|
+
|
709
|
+
### More Info on Message
|
710
|
+
|
711
|
+
Bunny's `delivery_info`, `properties` and payload are now accessible on `Hutch::Message`.
|
712
|
+
|
713
|
+
Contributed by gregory.
|
714
|
+
|
715
|
+
|
716
|
+
### Optional Config Parameters
|
717
|
+
|
718
|
+
`Hutch::Config` constructor now accepts an extra hash of optional
|
719
|
+
configuration parameters.
|
720
|
+
|
721
|
+
Contributed by Ignazio Mostallino.
|
722
|
+
|
723
|
+
|
724
|
+
## 0.9.0 — May 13, 2014
|
725
|
+
|
726
|
+
### Platform-aware Signal Registration
|
727
|
+
|
728
|
+
Hutch will no longer attempt to register signal traps
|
729
|
+
for signals not supported by the environment (e.g. on by certain OSes).
|
730
|
+
|
731
|
+
Contributed by Tobias Matthies.
|
732
|
+
|
733
|
+
### TLS Fixes
|
734
|
+
|
735
|
+
Hutch now properly passes client TLS key and certificate to
|
736
|
+
Bunny.
|
737
|
+
|
738
|
+
Contributed by Eric Nelson.
|
739
|
+
|
740
|
+
### Bunny Update
|
741
|
+
|
742
|
+
Bunny is updated to 1.2.x which should offer
|
743
|
+
[much better latency](https://github.com/ruby-amqp/bunny/pull/187) for
|
744
|
+
workloads with lots of small messages published frequently.
|
745
|
+
|
746
|
+
### More Unit Testing Friendly CLI/Runner
|
747
|
+
|
748
|
+
`Hutch::CLI#run` now accepts a parameter and is easier to use
|
749
|
+
in automated tests.
|
750
|
+
|
751
|
+
|
752
|
+
## 0.8.0 — February 13, 2014
|
753
|
+
|
754
|
+
### Uncaught Exceptions Result in Rejected Messages
|
755
|
+
|
756
|
+
Uncaught exceptions in consumers now result in Hutch rejecting
|
757
|
+
messages (deliveries) using `basic.nack`. This way they are [dead lettered](http://www.rabbitmq.com/dlx.html).
|
758
|
+
|
759
|
+
Contributed by Garrett Johnson.
|
760
|
+
|
761
|
+
### Missing Require
|
762
|
+
|
763
|
+
`hutch/consumer.rb` no longer fails to load with the
|
764
|
+
apps that do not `require "set"`.
|
765
|
+
|
766
|
+
Contributed by Garrett Johnson.
|
767
|
+
|
768
|
+
### Relaxed Queue Namespace Validation
|
769
|
+
|
770
|
+
Namespaces now can include any characters that are valid in RabbitMQ
|
771
|
+
queue names.
|
772
|
+
|
773
|
+
Contributed by Garrett Johnson.
|
774
|
+
|
775
|
+
### basic.qos Configuration
|
776
|
+
|
777
|
+
It is now possible to configure `basic.qos` (aka channel prefetch) setting
|
778
|
+
used by Hutch using the `:channel_prefetch` config key.
|
779
|
+
|
780
|
+
### Passwords No Longer Logged
|
781
|
+
|
782
|
+
Hutch now elides passwords from logs.
|
783
|
+
|
784
|
+
|
785
|
+
## 0.7.0 — January 14, 2014
|
786
|
+
|
787
|
+
### Optional HTTP API Use
|
788
|
+
|
789
|
+
It is now possible to make Hutch [not use RabbitMQ HTTP
|
790
|
+
API](https://github.com/gocardless/hutch/pull/69) (e.g. when the
|
791
|
+
RabbitMQ management plugin that provides it is not available).
|
792
|
+
|
793
|
+
|
794
|
+
### Extra Arguments for Hutch::Broker#publish
|
795
|
+
|
796
|
+
Extra options [passed to `Hutch::Broker#publish` will now be propagated](https://github.com/gocardless/hutch/pull/61).
|
797
|
+
|
798
|
+
|
799
|
+
### Content-Type for Messages
|
800
|
+
|
801
|
+
Messages published with Hutch now have content type set
|
802
|
+
to `application/json`.
|
803
|
+
|
804
|
+
|
805
|
+
### Greater Heartbeat Interval
|
806
|
+
|
807
|
+
Hutch now uses heartbeat interval of 30, so heartbeats won't interfere with transfers
|
808
|
+
of large messages over high latency networks (e.g. between AWS availability regions).
|
809
|
+
|
810
|
+
|
811
|
+
### Custom Queue Names
|
812
|
+
|
813
|
+
It is now possible to [specify an optional queue name](https://github.com/gocardless/hutch/pull/49):
|
814
|
+
|
815
|
+
``` ruby
|
816
|
+
class FailedPaymentConsumer
|
817
|
+
include Hutch::Consumer
|
818
|
+
consume 'gc.ps.payment.failed'
|
819
|
+
queue_name 'failed_payments'
|
820
|
+
|
821
|
+
def process(message)
|
822
|
+
mark_payment_as_failed(message[:id])
|
823
|
+
end
|
824
|
+
end
|
825
|
+
```
|
826
|
+
|
827
|
+
### Global Properties for Publishers
|
828
|
+
|
829
|
+
[Global properties can now be specified](https://github.com/gocardless/hutch/pull/62) for publishing:
|
830
|
+
|
831
|
+
``` ruby
|
832
|
+
Hutch.global_properties = proc {
|
833
|
+
{ app_id: 'api', headers: { request_id: RequestId.request_id } }
|
834
|
+
}
|
835
|
+
```
|
836
|
+
|
837
|
+
## 0.6.0 - November 4, 2013
|
838
|
+
|
839
|
+
- Metadata can now be passed in to `#publish`
|
840
|
+
|
841
|
+
## 0.5.1 - October 17, 2013
|
842
|
+
|
843
|
+
- Raise an exception when publishing fails
|
844
|
+
|
845
|
+
## 0.5.0 - October 17, 2013
|
846
|
+
|
847
|
+
- Support for the `--mq-tls-key` and `--mq-tls-cert` configuration options.
|
848
|
+
|
849
|
+
## 0.4.5 - October 15, 2013
|
850
|
+
|
851
|
+
- No exception raised when hutch is run with no consumers. Instead, a warning
|
852
|
+
is logged.
|
853
|
+
- Internal refactoring: use Bunny's shiny `ConsumerWorkPool#threads`
|
854
|
+
attr_reader.
|
855
|
+
|
856
|
+
## 0.4.4 - October 12, 2013
|
857
|
+
|
858
|
+
- Friendlier Message#inspect, doesn't spew out detailed bunny info.
|
859
|
+
|
860
|
+
## 0.4.3 - October 11, 2013
|
861
|
+
|
862
|
+
- More autoloading tweaks, all internal modules are now autoloaded.
|
863
|
+
|
864
|
+
## 0.4.2 - October 11, 2013
|
865
|
+
|
866
|
+
- Autoload the Broker module, which was missed in the previous release.
|
867
|
+
|
868
|
+
## 0.4.1 - October 11, 2013
|
869
|
+
|
870
|
+
- Autoload internal modules. Fixes regression where the `Config` module was
|
871
|
+
not available by simply `require`ing `hutch`.
|
872
|
+
|
873
|
+
## 0.4.0 - October 9, 2013
|
874
|
+
|
875
|
+
- Support for loading configuration from a file, specified with the `--config`
|
876
|
+
command line option.
|
877
|
+
|
878
|
+
## 0.3.0 - September 24, 2013
|
879
|
+
|
880
|
+
- Add `--[no-]autoload-rails` flag to optionally disable the autoloading of
|
881
|
+
Rails apps in the current directory
|
882
|
+
|
883
|
+
## 0.2.1 - September 17, 2013
|
884
|
+
|
885
|
+
- Fix inconsistency with `mq-tls` option
|
886
|
+
|
887
|
+
## 0.2.0 - September 16, 2013
|
888
|
+
|
889
|
+
- Support for connecting to RabbitMQ with TLS/SSL. There are two new
|
890
|
+
configuration options : `mq-tls` and `mq-api-ssl`.
|
891
|
+
- JSON message parsing errors are now handled properly.
|
892
|
+
|
893
|
+
## 0.1.1 - September 9, 2013
|
894
|
+
|
895
|
+
- Relax Bunny dependency specification
|
896
|
+
|
897
|
+
## 0.1.0 - September 9, 2013
|
898
|
+
|
899
|
+
- Initial release
|