hutch 0.24.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +18 -13
- data/CHANGELOG.md +227 -4
- data/Gemfile +3 -3
- data/LICENSE +1 -0
- data/README.md +94 -94
- data/bin/ci/before_build.sh +20 -0
- data/bin/ci/install_on_debian.sh +17 -0
- data/hutch.gemspec +5 -5
- data/lib/hutch.rb +8 -4
- data/lib/hutch/broker.rb +37 -10
- data/lib/hutch/cli.rb +22 -11
- data/lib/hutch/config.rb +12 -0
- data/lib/hutch/consumer.rb +32 -2
- data/lib/hutch/error_handlers.rb +1 -1
- data/lib/hutch/error_handlers/airbrake.rb +20 -2
- data/lib/hutch/error_handlers/base.rb +15 -0
- data/lib/hutch/error_handlers/honeybadger.rb +28 -14
- data/lib/hutch/error_handlers/logger.rb +7 -2
- data/lib/hutch/error_handlers/rollbar.rb +28 -0
- data/lib/hutch/error_handlers/sentry.rb +9 -2
- data/lib/hutch/publisher.rb +1 -1
- data/lib/hutch/tracers.rb +0 -1
- data/lib/hutch/version.rb +1 -2
- data/lib/hutch/waiter.rb +1 -1
- data/lib/hutch/worker.rb +30 -1
- data/spec/hutch/broker_spec.rb +34 -0
- data/spec/hutch/cli_spec.rb +13 -0
- data/spec/hutch/consumer_spec.rb +82 -4
- data/spec/hutch/error_handlers/airbrake_spec.rb +19 -0
- data/spec/hutch/error_handlers/honeybadger_spec.rb +22 -1
- data/spec/hutch/error_handlers/logger_spec.rb +11 -0
- data/spec/hutch/error_handlers/rollbar_spec.rb +45 -0
- data/spec/hutch/error_handlers/sentry_spec.rb +15 -0
- data/spec/hutch/waiter_spec.rb +2 -2
- data/spec/hutch/worker_spec.rb +1 -1
- metadata +22 -17
- data/lib/hutch/error_handlers/opbeat.rb +0 -24
- data/lib/hutch/tracers/opbeat.rb +0 -37
- data/spec/hutch/error_handlers/opbeat_spec.rb +0 -22
- data/spec/tracers/opbeat_spec.rb +0 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 626b85f02b69ee2113376ff382173fd124cdcae1bdc404f0681874e76a80310e
|
4
|
+
data.tar.gz: 3d1d6a2cd275b1c2d72d4842841ad90f70145cabe6800ff3860b206aebf0308e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1b0c80bf6362b0cfbc6f54b3257c74549c6d927fbae3bcaecb50aeb4ed0f28e01466a6a3013ce9175f55eb481b2e9378f89954edcc1453753da00b76873c766
|
7
|
+
data.tar.gz: 4c346421c5c1fa49440866b56486cc75d68c3eed8c3014ae2f51e2643f40a59b084634248b52d32965b65f692d1560250a8f5add30c4b75b2f541c895574aa26
|
data/.travis.yml
CHANGED
@@ -1,19 +1,24 @@
|
|
1
|
+
dist: bionic
|
2
|
+
sudo: required
|
3
|
+
|
1
4
|
language: ruby
|
2
5
|
cache: bundler
|
3
6
|
before_install:
|
4
|
-
- gem update --system
|
5
7
|
- gem install bundler
|
8
|
+
before_script:
|
9
|
+
- "./bin/ci/install_on_debian.sh"
|
10
|
+
- until sudo lsof -i:5672; do echo "Waiting for RabbitMQ to start..."; sleep 1; done
|
11
|
+
- "./bin/ci/before_build.sh"
|
6
12
|
matrix:
|
7
13
|
include:
|
8
|
-
- rvm: 2.
|
9
|
-
- rvm: 2.
|
10
|
-
- rvm: 2.
|
11
|
-
- rvm: 2.
|
12
|
-
- rvm: 2.
|
13
|
-
- rvm: jruby-9.
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
- rabbitmq
|
14
|
+
- rvm: "2.7.1"
|
15
|
+
- rvm: "2.6.6"
|
16
|
+
- rvm: "2.5.8"
|
17
|
+
- rvm: "2.4.10"
|
18
|
+
- rvm: "2.3.8"
|
19
|
+
- rvm: "jruby-9.2.9.0"
|
20
|
+
- rvm: "ruby-head"
|
21
|
+
allow_failures:
|
22
|
+
rvm:
|
23
|
+
- "jruby-9.2.9.0"
|
24
|
+
- ruby-head
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,228 @@
|
|
1
|
-
## 0.
|
1
|
+
## 1.0.1 (in development)
|
2
|
+
|
3
|
+
No changes yet.
|
4
|
+
|
5
|
+
## 1.0.0 (April 8th, 2020)
|
6
|
+
|
7
|
+
Hutch has been around for several years. It is time to ship a 1.0. With it we try to correct
|
8
|
+
a few of overly opinionated decisions from recent releases. This means this release
|
9
|
+
contains potentially breaking changes.
|
10
|
+
|
11
|
+
### Breaking Changes
|
12
|
+
|
13
|
+
* Hutch will no longer configure any queue type (such as [quorum queues](https://www.rabbitmq.com/quorum-queues.html))
|
14
|
+
or queue mode (used by classic [lazy queues](https://www.rabbitmq.com/lazy-queues.html))
|
15
|
+
by default as that can be breaking change for existing Hutch and RabbitMQ installations due to the
|
16
|
+
[property equivalence requirement](https://www.rabbitmq.com/queues.html#property-equivalence) in AMQP 0-9-1.
|
17
|
+
|
18
|
+
This means **some defaults introduced in `0.28.0` ([gocardless/hutch#341](https://github.com/gocardless/hutch/pull/341)) were reverted**.
|
19
|
+
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.
|
20
|
+
Most optional arguments can be set via [policies](https://www.rabbitmq.com/parameters.html#policies) which is always the recommended approach.
|
21
|
+
Queue type, unfortunately, is not one of them as different queue types have completely different
|
22
|
+
implementation details, on disk data formats and so on.
|
23
|
+
|
24
|
+
To use a quorum queue, use the `quorum_queue` consumer DSL method:
|
25
|
+
|
26
|
+
``` ruby
|
27
|
+
class ConsumerUsingQuorumQueue
|
28
|
+
include Hutch::Consumer
|
29
|
+
consume 'hutch.test1'
|
30
|
+
# when in doubt, prefer using a policy to this DSL
|
31
|
+
# https://www.rabbitmq.com/parameters.html#policies
|
32
|
+
arguments 'x-key': :value
|
33
|
+
|
34
|
+
quorum_queue
|
35
|
+
end
|
36
|
+
```
|
37
|
+
|
38
|
+
To use a classic lazy queue, use the `lazy_queue` consumer DSL method:
|
39
|
+
|
40
|
+
``` ruby
|
41
|
+
class ConsumerUsingLazyQueue
|
42
|
+
include Hutch::Consumer
|
43
|
+
consume 'hutch.test1'
|
44
|
+
# when in doubt, prefer using a policy to this DSL
|
45
|
+
# https://www.rabbitmq.com/parameters.html#policies
|
46
|
+
arguments 'x-key': :value
|
47
|
+
|
48
|
+
lazy_queue
|
49
|
+
classic_queue
|
50
|
+
end
|
51
|
+
```
|
52
|
+
|
53
|
+
By default Hutch will not configure any `x-queue-type` or `x-queue-mode` optional arguments
|
54
|
+
which is identical to RabbitMQ defaults (a regular classic queue).
|
55
|
+
|
56
|
+
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)
|
57
|
+
to `x-queue-type` set to `classic` by RabbitMQ server.
|
58
|
+
|
59
|
+
|
60
|
+
#### Enhancements
|
61
|
+
|
62
|
+
* Exchange type is now configurable via the `` config setting. Supported exchanges must be
|
63
|
+
compatible with topic exchanges (e.g. wrap it). Default value is `"topic"`.
|
64
|
+
|
65
|
+
This feature is limited to topic and delayed message exchange plugins and is mostly
|
66
|
+
useful for forward compatibility.
|
67
|
+
|
68
|
+
Contributed by Michael Bumann.
|
69
|
+
|
70
|
+
GitHub issue: [gocardless/hutch#349](https://github.com/gocardless/hutch/pull/349)
|
71
|
+
|
72
|
+
|
73
|
+
## 0.28.0 (March 17, 2020)
|
74
|
+
|
75
|
+
### Enhancements
|
76
|
+
|
77
|
+
* Add lazy and quorum options for queues.
|
78
|
+
|
79
|
+
GitHub issue: [gocardless/hutch#341](https://github.com/gocardless/hutch/pull/341)
|
80
|
+
|
81
|
+
Contributed by: Arthur Del Esposte
|
82
|
+
|
83
|
+
* Log level in the message publisher switched to DEBUG.
|
84
|
+
|
85
|
+
GitHub issue: [gocardless/hutch#343](https://github.com/gocardless/hutch/pull/343)
|
86
|
+
|
87
|
+
Contributed by: Codruț Constantin Gușoi
|
88
|
+
|
89
|
+
### Documentation
|
90
|
+
|
91
|
+
* Add zeitwerk note to README.
|
92
|
+
|
93
|
+
GitHub issue: [gocardless/hutch#342](https://github.com/gocardless/hutch/pull/342)
|
94
|
+
|
95
|
+
Contributed by: Paolo Zaccagnini
|
96
|
+
|
97
|
+
### CI
|
98
|
+
|
99
|
+
* Use jruby-9.2.9.0
|
100
|
+
|
101
|
+
GitHub issue: [gocardless/hutch#336](https://github.com/gocardless/hutch/pull/336)
|
102
|
+
|
103
|
+
Contributed by: Olle Jonsson
|
104
|
+
|
105
|
+
## 0.27.0 (September 9th, 2019)
|
106
|
+
|
107
|
+
### Enhancements
|
108
|
+
|
109
|
+
* Error handler for Rollback.
|
110
|
+
|
111
|
+
GitHub issue: [gocardless/hutch#332](https://github.com/gocardless/hutch/pull/332)
|
112
|
+
|
113
|
+
Contributed by Johan Kok.
|
114
|
+
|
115
|
+
### Bug Fixes
|
116
|
+
|
117
|
+
* Allow for the latest ActiveSupport version.
|
118
|
+
|
119
|
+
GitHub issue: [gocardless/hutch#334](https://github.com/gocardless/hutch/pull/334)
|
120
|
+
|
121
|
+
* Signal tests are now skipped on JRuby.
|
122
|
+
|
123
|
+
Contributed by Olle Jonsson.
|
124
|
+
|
125
|
+
GitHub issue: [gocardless/hutch#326](https://github.com/gocardless/hutch/pull/326)
|
126
|
+
|
127
|
+
### Dependency Bumps
|
128
|
+
|
129
|
+
Bunny and other dependencies were updated to their latest release
|
130
|
+
series.
|
131
|
+
|
132
|
+
|
133
|
+
## 0.26.0 (February 13th, 2019)
|
134
|
+
|
135
|
+
### Dependency Bumps
|
136
|
+
|
137
|
+
Bunny and other dependencies were updated to their latest release
|
138
|
+
series.
|
139
|
+
|
140
|
+
### Synchronized Connection Code
|
141
|
+
|
142
|
+
The methods that connect to RabbitMQ are now synchronized which makes
|
143
|
+
them safer to use in concurrent settings. Note that Hutch still
|
144
|
+
uses a single Bunny channel which is not meant to be shared
|
145
|
+
between threads without application-level synchronization for publishing.
|
146
|
+
|
147
|
+
Contributed by Chris Barton.
|
148
|
+
|
149
|
+
GitHub issue: [#308](https://github.com/gocardless/hutch/pull/308).
|
150
|
+
|
151
|
+
### More Bunny Options Propagated
|
152
|
+
|
153
|
+
Contributed by Damian Le Nouaille.
|
154
|
+
|
155
|
+
GitHub issue: [#322](https://github.com/gocardless/hutch/pull/322).
|
156
|
+
|
157
|
+
### Removed Opbeat Integration
|
158
|
+
|
159
|
+
The service is no longer generally available.
|
160
|
+
|
161
|
+
Contributed by Olle Jonsson.
|
162
|
+
|
163
|
+
GitHub issue: [#313](https://github.com/gocardless/hutch/pull/313)
|
164
|
+
|
165
|
+
|
166
|
+
## 0.25.0 - January 17th, 2018
|
167
|
+
|
168
|
+
### Consumer groups
|
169
|
+
|
170
|
+
Consumer groups allow you to run groups of consumers together, rather than running them
|
171
|
+
all at once in a single process. You define groups in your config file, and then specify
|
172
|
+
a `--only-group` option when starting up Hutch with `hutch`.
|
173
|
+
|
174
|
+
Contributed by Nickolai Smirnov.
|
175
|
+
|
176
|
+
GitHub pull request: [#296](https://github.com/gocardless/hutch/pull/296)
|
177
|
+
|
178
|
+
### Fix configuring Hutch with a URI
|
179
|
+
|
180
|
+
When Hutch is configured to connect to RabbitMQ with a URI, we should respect the
|
181
|
+
`amqps` specification, defaulting to the standard protocol ports when not specified.
|
182
|
+
|
183
|
+
This means, for example, that `amqp://guest:guest@127.0.0.1/` connects to the server on
|
184
|
+
port 5672 and does not use TLS, whereas `amqps://guest:guest@127.0.0.1/` connects to the
|
185
|
+
server on port 5671 and uses TLS.
|
186
|
+
|
187
|
+
This behaviour was introduced in [#159](https://github.com/gocardless/hutch/pull/159) but
|
188
|
+
broken since then. This fixes it, and includes tests.
|
189
|
+
|
190
|
+
Contributed by Michael Canden-Lennox.
|
191
|
+
|
192
|
+
GitHub pull request: [#305](https://github.com/gocardless/hutch/pull/305)
|
193
|
+
|
194
|
+
### Pass exceptions when setting up the client to configured error handlers
|
195
|
+
|
196
|
+
When an error occurs during Hutch's startup, it is currently not passed to the configured
|
197
|
+
error handlers. This starts handling those exceptions.
|
198
|
+
|
199
|
+
Contributed by Valentin Krasontovitsch.
|
200
|
+
|
201
|
+
GitHub issue: [#288](https://github.com/gocardless/hutch/issues/288)
|
202
|
+
GitHub pull request: [#301](https://github.com/gocardless/hutch/pull/301)
|
203
|
+
|
204
|
+
### Log the Rails environment when running Hutch in verbose mode
|
205
|
+
|
206
|
+
When starting up Hutch in verbose mode with `hutch -v`, the Rails environment is now
|
207
|
+
logged.
|
208
|
+
|
209
|
+
Contributed by [@wppurking](https://github.com/wppurking).
|
210
|
+
|
211
|
+
GitHub pull request: [#282](https://github.com/gocardless/hutch/pull/282)
|
212
|
+
|
213
|
+
### Make the Honeybadger error handler compatible with new versions of `honeybadger-ruby`
|
214
|
+
|
215
|
+
[`honeybadger-ruby`](https://github.com/honeybadger-io/honeybadger-ruby/)
|
216
|
+
[changed](https://github.com/honeybadger-io/honeybadger-ruby/blob/master/CHANGELOG.md#300---2017-02-06)
|
217
|
+
its API in v3.0.0. This updates our error handler to work with that, whilst still
|
218
|
+
maintaining our existing behaviour.
|
219
|
+
|
220
|
+
Contributed by Olle Jonsson and Bill Ruddock.
|
221
|
+
|
222
|
+
GitHub pull requests: [#274](https://github.com/gocardless/hutch/pull/274),
|
223
|
+
[#290](https://github.com/gocardless/hutch/pull/290)
|
224
|
+
|
225
|
+
## 0.24.0 — February 1st, 2017
|
2
226
|
|
3
227
|
### Configurable Consumer Prefixes
|
4
228
|
|
@@ -14,7 +238,7 @@ Hutch will now handle several OS signals:
|
|
14
238
|
|
15
239
|
* `USR2` will log stack traces of all alive VM threads
|
16
240
|
* `QUIT` (except on JRuby), `INT`, `TERM` will cause Hutch daemon to shut down
|
17
|
-
|
241
|
+
|
18
242
|
Contributed by Olle Jonsson.
|
19
243
|
|
20
244
|
GitHub issues: [#263](https://github.com/gocardless/hutch/pull/263), [#271](https://github.com/gocardless/hutch/pull/271)
|
@@ -98,7 +322,7 @@ Contributed by Seamus Abshere.
|
|
98
322
|
|
99
323
|
### Worker: Log received messages using level DEBUG instead of INFO
|
100
324
|
|
101
|
-
Received messages used to be logged using severity level INFO.
|
325
|
+
Received messages used to be logged using severity level INFO.
|
102
326
|
This has been lowered to DEBUG.
|
103
327
|
|
104
328
|
Contributed by Jesper Josefsson.
|
@@ -630,4 +854,3 @@ Hutch.global_properties = proc {
|
|
630
854
|
## 0.1.0 - September 9, 2013
|
631
855
|
|
632
856
|
- Initial release
|
633
|
-
|
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
ruby
|
3
|
+
ruby '>= 2.3.0'
|
4
4
|
|
5
5
|
gemspec
|
6
6
|
|
@@ -23,8 +23,8 @@ group :development, :test do
|
|
23
23
|
gem "honeybadger"
|
24
24
|
gem "coveralls", "~> 0.8.15", require: false
|
25
25
|
gem "newrelic_rpm"
|
26
|
-
gem "airbrake", "~>
|
27
|
-
gem "
|
26
|
+
gem "airbrake", "~> 10.0"
|
27
|
+
gem "rollbar"
|
28
28
|
end
|
29
29
|
|
30
30
|
group :development, :darwin do
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/hutch.svg)](http://badge.fury.io/rb/hutch)
|
4
4
|
[![Build Status](https://travis-ci.org/gocardless/hutch.svg?branch=master)](https://travis-ci.org/gocardless/hutch)
|
5
|
-
[![Dependency Status](https://gemnasium.com/gocardless/hutch.svg)](https://gemnasium.com/gocardless/hutch)
|
6
5
|
[![Code Climate](https://codeclimate.com/github/gocardless/hutch.svg)](https://codeclimate.com/github/gocardless/hutch)
|
7
6
|
|
8
7
|
Hutch is a Ruby library for enabling asynchronous inter-service communication
|
@@ -40,7 +39,7 @@ gem install hutch
|
|
40
39
|
|
41
40
|
## Requirements
|
42
41
|
|
43
|
-
- Hutch requires Ruby 2.
|
42
|
+
- Hutch requires Ruby 2.3+ or JRuby 9K.
|
44
43
|
- Hutch requires RabbitMQ 3.3 or later.
|
45
44
|
|
46
45
|
## Overview
|
@@ -59,8 +58,9 @@ Hutch uses [Bunny](http://rubybunny.info) or [March Hare](http://rubymarchhare.i
|
|
59
58
|
|
60
59
|
### Project Maturity
|
61
60
|
|
62
|
-
Hutch is a
|
63
|
-
|
61
|
+
Hutch is a mature project that was originally extracted from production systems
|
62
|
+
at [GoCardless](https://gocardless.com) in 2013 and is now maintained by a large
|
63
|
+
group of contributors.
|
64
64
|
|
65
65
|
## Consumers
|
66
66
|
|
@@ -80,8 +80,8 @@ message[:id] # => "02ABCXYZ"
|
|
80
80
|
To subscribe to a topic, pass a routing key to `consume` in the class
|
81
81
|
definition. To bind to multiple routing keys, simply pass extra routing keys
|
82
82
|
in as additional arguments. Refer to the [RabbitMQ docs on topic exchanges
|
83
|
-
]
|
84
|
-
example consumer:
|
83
|
+
](http://www.rabbitmq.com/tutorials/tutorial-five-ruby.html) for more information
|
84
|
+
about how to use routing keys. Here's an example consumer:
|
85
85
|
|
86
86
|
```ruby
|
87
87
|
class FailedPaymentConsumer
|
@@ -109,6 +109,28 @@ class FailedPaymentConsumer
|
|
109
109
|
end
|
110
110
|
```
|
111
111
|
|
112
|
+
It is possible to set some custom options to consumer's queue explicitly.
|
113
|
+
This example sets the consumer's queue as a
|
114
|
+
[quorum queue](https://www.rabbitmq.com/quorum-queues.html)
|
115
|
+
and to operate in the [lazy mode](https://www.rabbitmq.com/lazy-queues.html).
|
116
|
+
The `initial_group_size`
|
117
|
+
[argument](https://www.rabbitmq.com/quorum-queues.html#replication-factor) is
|
118
|
+
optional.
|
119
|
+
|
120
|
+
```ruby
|
121
|
+
class FailedPaymentConsumer
|
122
|
+
include Hutch::Consumer
|
123
|
+
consume 'gc.ps.payment.failed'
|
124
|
+
queue_name 'failed_payments'
|
125
|
+
lazy_queue
|
126
|
+
quorum_queue initial_group_size: 3
|
127
|
+
|
128
|
+
def process(message)
|
129
|
+
mark_payment_as_failed(message[:id])
|
130
|
+
end
|
131
|
+
end
|
132
|
+
```
|
133
|
+
|
112
134
|
You can also set custom arguments per consumer. This example declares a consumer with
|
113
135
|
a maximum length of 10 messages:
|
114
136
|
|
@@ -120,7 +142,9 @@ class FailedPaymentConsumer
|
|
120
142
|
end
|
121
143
|
```
|
122
144
|
|
123
|
-
|
145
|
+
This sets the `x-max-length` header. For more details, see the [RabbitMQ
|
146
|
+
documentation on Queue Length Limit](https://www.rabbitmq.com/maxlength.html). To find out more
|
147
|
+
about custom queue arguments, consult the [RabbitMQ documentation on AMQP Protocol Extensions](https://www.rabbitmq.com/extensions.html).
|
124
148
|
|
125
149
|
Consumers can write to Hutch's log by calling the logger method. The logger method returns
|
126
150
|
a [Logger object](http://ruby-doc.org/stdlib-2.1.2/libdoc/logger/rdoc/Logger.html).
|
@@ -164,7 +188,7 @@ This will enable NewRelic custom instrumentation:
|
|
164
188
|
Hutch::Config.set(:tracer, Hutch::Tracers::NewRelic)
|
165
189
|
```
|
166
190
|
|
167
|
-
Batteries included!
|
191
|
+
Batteries included!
|
168
192
|
|
169
193
|
## Running Hutch
|
170
194
|
|
@@ -217,6 +241,24 @@ directory of a Rails app, or pass the path to a Rails app in with the
|
|
217
241
|
the `app/consumers/` directory, to allow them to be auto-loaded when Rails
|
218
242
|
boots.
|
219
243
|
|
244
|
+
If you're using the new Zeitwerk autoloader (enabled by default in Rails 6)
|
245
|
+
and the consumers are not loaded in development environment you will need to
|
246
|
+
trigger the autoloading in an initializer with
|
247
|
+
|
248
|
+
```ruby
|
249
|
+
::Zeitwerk::Loader.eager_load_all
|
250
|
+
```
|
251
|
+
|
252
|
+
or with something more specific like
|
253
|
+
|
254
|
+
```ruby
|
255
|
+
autoloader = Rails.autoloaders.main
|
256
|
+
|
257
|
+
Dir.glob(File.join('app/consumers', '*_consumer.rb')).each do |consumer|
|
258
|
+
autoloader.preload(consumer)
|
259
|
+
end
|
260
|
+
```
|
261
|
+
|
220
262
|
To require files that define consumers manually, simply pass each file as an
|
221
263
|
option to `--require`. Hutch will automatically detect whether you've provided
|
222
264
|
a Rails app or a standard file, and take the appropriate behaviour:
|
@@ -300,8 +342,8 @@ AMQP.connect(host: config[:host]) do |connection|
|
|
300
342
|
end
|
301
343
|
```
|
302
344
|
|
303
|
-
If using publisher confirms with amqp gem, see [this issue]
|
304
|
-
and [this gist]
|
345
|
+
If using publisher confirms with amqp gem, see [this issue](https://github.com/ruby-amqp/amqp/issues/92)
|
346
|
+
and [this gist](https://gist.github.com/3042381) for more info.
|
305
347
|
|
306
348
|
## Configuration
|
307
349
|
|
@@ -339,6 +381,8 @@ Known configuration parameters are:
|
|
339
381
|
* `connection_timeout`: Bunny's socket open timeout (default: `11`)
|
340
382
|
* `read_timeout`: Bunny's socket read timeout (default: `11`)
|
341
383
|
* `write_timeout`: Bunny's socket write timeout (default: `11`)
|
384
|
+
* `automatically_recover`: Bunny's enable/disable network recovery (default: `true`)
|
385
|
+
* `network_recovery_interval`: Bunny's reconnect interval (default: `1`)
|
342
386
|
* `tracer`: tracer to use to track message processing
|
343
387
|
|
344
388
|
### Environment variables
|
@@ -384,245 +428,201 @@ Generate with
|
|
384
428
|
</tr>
|
385
429
|
</thead>
|
386
430
|
<tbody>
|
387
|
-
|
388
431
|
<tr>
|
389
432
|
<td><tt>mq_host</tt></td>
|
390
433
|
<td>127.0.0.1</td>
|
391
434
|
<td>String</td>
|
392
435
|
<td><tt>HUTCH_MQ_HOST</tt></td>
|
393
|
-
<td><p>RabbitMQ hostname</p>
|
394
|
-
</td>
|
436
|
+
<td><p>RabbitMQ hostname</p></td>
|
395
437
|
</tr>
|
396
|
-
|
397
438
|
<tr>
|
398
439
|
<td><tt>mq_exchange</tt></td>
|
399
440
|
<td>hutch</td>
|
400
441
|
<td>String</td>
|
401
442
|
<td><tt>HUTCH_MQ_EXCHANGE</tt></td>
|
402
|
-
<td><p>RabbitMQ Exchange to use for publishing</p>
|
403
|
-
</td>
|
443
|
+
<td><p>RabbitMQ Exchange to use for publishing</p></td>
|
404
444
|
</tr>
|
405
|
-
|
406
445
|
<tr>
|
407
446
|
<td><tt>mq_vhost</tt></td>
|
408
447
|
<td>/</td>
|
409
448
|
<td>String</td>
|
410
449
|
<td><tt>HUTCH_MQ_VHOST</tt></td>
|
411
|
-
<td><p>RabbitMQ vhost to use</p>
|
412
|
-
</td>
|
450
|
+
<td><p>RabbitMQ vhost to use</p></td>
|
413
451
|
</tr>
|
414
|
-
|
415
452
|
<tr>
|
416
453
|
<td><tt>mq_username</tt></td>
|
417
454
|
<td>guest</td>
|
418
455
|
<td>String</td>
|
419
456
|
<td><tt>HUTCH_MQ_USERNAME</tt></td>
|
420
|
-
<td><p>RabbitMQ username to use.</p>
|
421
|
-
</td>
|
457
|
+
<td><p>RabbitMQ username to use.</p></td>
|
422
458
|
</tr>
|
423
|
-
|
424
459
|
<tr>
|
425
460
|
<td><tt>mq_password</tt></td>
|
426
461
|
<td>guest</td>
|
427
462
|
<td>String</td>
|
428
463
|
<td><tt>HUTCH_MQ_PASSWORD</tt></td>
|
429
|
-
<td><p>RabbitMQ password</p>
|
430
|
-
</td>
|
464
|
+
<td><p>RabbitMQ password</p></td>
|
431
465
|
</tr>
|
432
|
-
|
433
466
|
<tr>
|
434
467
|
<td><tt>uri</tt></td>
|
435
468
|
<td>nil</td>
|
436
469
|
<td>String</td>
|
437
470
|
<td><tt>HUTCH_URI</tt></td>
|
438
|
-
<td><p>RabbitMQ URI (takes precedence over MQ username, password, host, port and vhost settings)</p>
|
439
|
-
</td>
|
471
|
+
<td><p>RabbitMQ URI (takes precedence over MQ username, password, host, port and vhost settings)</p></td>
|
440
472
|
</tr>
|
441
|
-
|
442
473
|
<tr>
|
443
474
|
<td><tt>mq_api_host</tt></td>
|
444
475
|
<td>127.0.0.1</td>
|
445
476
|
<td>String</td>
|
446
477
|
<td><tt>HUTCH_MQ_API_HOST</tt></td>
|
447
|
-
<td><p>RabbitMQ HTTP API hostname</p>
|
448
|
-
</td>
|
478
|
+
<td><p>RabbitMQ HTTP API hostname</p></td>
|
449
479
|
</tr>
|
450
|
-
|
451
480
|
<tr>
|
452
481
|
<td><tt>mq_port</tt></td>
|
453
482
|
<td>5672</td>
|
454
483
|
<td>Number</td>
|
455
484
|
<td><tt>HUTCH_MQ_PORT</tt></td>
|
456
|
-
<td><p>RabbitMQ port</p>
|
457
|
-
</td>
|
485
|
+
<td><p>RabbitMQ port</p></td>
|
458
486
|
</tr>
|
459
|
-
|
460
487
|
<tr>
|
461
488
|
<td><tt>mq_api_port</tt></td>
|
462
489
|
<td>15672</td>
|
463
490
|
<td>Number</td>
|
464
491
|
<td><tt>HUTCH_MQ_API_PORT</tt></td>
|
465
|
-
<td><p>RabbitMQ HTTP API port</p>
|
466
|
-
</td>
|
492
|
+
<td><p>RabbitMQ HTTP API port</p></td>
|
467
493
|
</tr>
|
468
|
-
|
469
494
|
<tr>
|
470
495
|
<td><tt>heartbeat</tt></td>
|
471
496
|
<td>30</td>
|
472
497
|
<td>Number</td>
|
473
498
|
<td><tt>HUTCH_HEARTBEAT</tt></td>
|
474
|
-
<td><p><a href="http://rabbitmq.com/heartbeats.html">RabbitMQ heartbeat timeout</a></p>
|
475
|
-
</td>
|
499
|
+
<td><p><a href="http://rabbitmq.com/heartbeats.html">RabbitMQ heartbeat timeout</a></p></td>
|
476
500
|
</tr>
|
477
|
-
|
478
501
|
<tr>
|
479
502
|
<td><tt>channel_prefetch</tt></td>
|
480
503
|
<td>0</td>
|
481
504
|
<td>Number</td>
|
482
505
|
<td><tt>HUTCH_CHANNEL_PREFETCH</tt></td>
|
483
|
-
<td><p>The <tt>basic.qos</tt> prefetch value to use.</p>
|
484
|
-
</td>
|
506
|
+
<td><p>The <tt>basic.qos</tt> prefetch value to use.</p></td>
|
485
507
|
</tr>
|
486
|
-
|
487
508
|
<tr>
|
488
509
|
<td><tt>connection_timeout</tt></td>
|
489
510
|
<td>11</td>
|
490
511
|
<td>Number</td>
|
491
512
|
<td><tt>HUTCH_CONNECTION_TIMEOUT</tt></td>
|
492
|
-
<td><p>Bunny's socket open timeout</p>
|
493
|
-
</td>
|
513
|
+
<td><p>Bunny's socket open timeout</p></td>
|
494
514
|
</tr>
|
495
|
-
|
496
515
|
<tr>
|
497
516
|
<td><tt>read_timeout</tt></td>
|
498
517
|
<td>11</td>
|
499
518
|
<td>Number</td>
|
500
519
|
<td><tt>HUTCH_READ_TIMEOUT</tt></td>
|
501
|
-
<td><p>Bunny's socket read timeout</p>
|
502
|
-
</td>
|
520
|
+
<td><p>Bunny's socket read timeout</p></td>
|
503
521
|
</tr>
|
504
|
-
|
505
522
|
<tr>
|
506
523
|
<td><tt>write_timeout</tt></td>
|
507
524
|
<td>11</td>
|
508
525
|
<td>Number</td>
|
509
526
|
<td><tt>HUTCH_WRITE_TIMEOUT</tt></td>
|
510
|
-
<td><p>Bunny's socket write timeout</p>
|
511
|
-
</
|
527
|
+
<td><p>Bunny's socket write timeout</p></td>
|
528
|
+
</tr>
|
529
|
+
<tr>
|
530
|
+
<td><tt>automatically_recover</tt></td>
|
531
|
+
<td>true</td>
|
532
|
+
<td>Boolean</td>
|
533
|
+
<td><tt>HUTCH_AUTOMATICALLY_RECOVER</tt></td>
|
534
|
+
<td><p>Bunny's enable/disable network recovery</p></td>
|
535
|
+
</tr>
|
536
|
+
<tr>
|
537
|
+
<td><tt>network_recovery_interval</tt></td>
|
538
|
+
<td>1</td>
|
539
|
+
<td>Number</td>
|
540
|
+
<td><tt>HUTCH_NETWORK_RECOVERY_INTERVAL</tt></td>
|
541
|
+
<td><p>Bunny's reconnect interval</p></td>
|
512
542
|
</tr>
|
513
|
-
|
514
543
|
<tr>
|
515
544
|
<td><tt>graceful_exit_timeout</tt></td>
|
516
545
|
<td>11</td>
|
517
546
|
<td>Number</td>
|
518
547
|
<td><tt>HUTCH_GRACEFUL_EXIT_TIMEOUT</tt></td>
|
519
|
-
<td><p>FIXME: DOCUMENT THIS</p>
|
520
|
-
</td>
|
548
|
+
<td><p>FIXME: DOCUMENT THIS</p></td>
|
521
549
|
</tr>
|
522
|
-
|
523
550
|
<tr>
|
524
551
|
<td><tt>consumer_pool_size</tt></td>
|
525
552
|
<td>1</td>
|
526
553
|
<td>Number</td>
|
527
554
|
<td><tt>HUTCH_CONSUMER_POOL_SIZE</tt></td>
|
528
|
-
<td><p>Bunny consumer work pool size</p>
|
529
|
-
</td>
|
555
|
+
<td><p>Bunny consumer work pool size</p></td>
|
530
556
|
</tr>
|
531
|
-
|
532
557
|
<tr>
|
533
558
|
<td><tt>mq_tls</tt></td>
|
534
559
|
<td>false</td>
|
535
560
|
<td>Boolean</td>
|
536
561
|
<td><tt>HUTCH_MQ_TLS</tt></td>
|
537
|
-
<td><p>Should TLS be used?</p>
|
538
|
-
</td>
|
562
|
+
<td><p>Should TLS be used?</p></td>
|
539
563
|
</tr>
|
540
|
-
|
541
564
|
<tr>
|
542
565
|
<td><tt>mq_verify_peer</tt></td>
|
543
566
|
<td>true</td>
|
544
567
|
<td>Boolean</td>
|
545
568
|
<td><tt>HUTCH_MQ_VERIFY_PEER</tt></td>
|
546
|
-
<td><p>Should SSL certificate be verified?</p>
|
547
|
-
</td>
|
569
|
+
<td><p>Should SSL certificate be verified?</p></td>
|
548
570
|
</tr>
|
549
|
-
|
550
571
|
<tr>
|
551
572
|
<td><tt>mq_api_ssl</tt></td>
|
552
573
|
<td>false</td>
|
553
574
|
<td>Boolean</td>
|
554
575
|
<td><tt>HUTCH_MQ_API_SSL</tt></td>
|
555
|
-
<td><p>Should SSL be used for the RabbitMQ API?</p>
|
556
|
-
</td>
|
576
|
+
<td><p>Should SSL be used for the RabbitMQ API?</p></td>
|
557
577
|
</tr>
|
558
|
-
|
559
578
|
<tr>
|
560
579
|
<td><tt>autoload_rails</tt></td>
|
561
580
|
<td>true</td>
|
562
581
|
<td>Boolean</td>
|
563
582
|
<td><tt>HUTCH_AUTOLOAD_RAILS</tt></td>
|
564
|
-
<td><p>Should the current Rails app directory be required?</p>
|
565
|
-
</td>
|
583
|
+
<td><p>Should the current Rails app directory be required?</p></td>
|
566
584
|
</tr>
|
567
|
-
|
568
585
|
<tr>
|
569
586
|
<td><tt>daemonise</tt></td>
|
570
587
|
<td>false</td>
|
571
588
|
<td>Boolean</td>
|
572
589
|
<td><tt>HUTCH_DAEMONISE</tt></td>
|
573
|
-
<td><p>Should the Hutch runner process daemonise?</p>
|
574
|
-
</td>
|
590
|
+
<td><p>Should the Hutch runner process daemonise?</p></td>
|
575
591
|
</tr>
|
576
|
-
|
577
592
|
<tr>
|
578
593
|
<td><tt>publisher_confirms</tt></td>
|
579
594
|
<td>false</td>
|
580
595
|
<td>Boolean</td>
|
581
596
|
<td><tt>HUTCH_PUBLISHER_CONFIRMS</tt></td>
|
582
|
-
<td><p>Should RabbitMQ publisher confirms be enabled?</p>
|
583
|
-
</td>
|
597
|
+
<td><p>Should RabbitMQ publisher confirms be enabled?</p></td>
|
584
598
|
</tr>
|
585
|
-
|
586
599
|
<tr>
|
587
600
|
<td><tt>force_publisher_confirms</tt></td>
|
588
601
|
<td>false</td>
|
589
602
|
<td>Boolean</td>
|
590
603
|
<td><tt>HUTCH_FORCE_PUBLISHER_CONFIRMS</tt></td>
|
591
|
-
<td><p>Enables publisher confirms, forces Hutch::Broker#wait_for_confirms for</p>
|
592
|
-
</td>
|
604
|
+
<td><p>Enables publisher confirms, forces Hutch::Broker#wait_for_confirms for</p></td>
|
593
605
|
</tr>
|
594
|
-
|
595
606
|
<tr>
|
596
607
|
<td><tt>enable_http_api_use</tt></td>
|
597
608
|
<td>true</td>
|
598
609
|
<td>Boolean</td>
|
599
610
|
<td><tt>HUTCH_ENABLE_HTTP_API_USE</tt></td>
|
600
|
-
<td><p>Should the RabbitMQ HTTP API be used?</p>
|
601
|
-
</td>
|
611
|
+
<td><p>Should the RabbitMQ HTTP API be used?</p></td>
|
602
612
|
</tr>
|
603
|
-
|
604
613
|
<tr>
|
605
614
|
<td><tt>consumer_pool_abort_on_exception</tt></td>
|
606
615
|
<td>false</td>
|
607
616
|
<td>Boolean</td>
|
608
617
|
<td><tt>HUTCH_CONSUMER_POOL_ABORT_ON_EXCEPTION</tt></td>
|
609
|
-
<td><p>Should Bunny's consumer work pool threads abort on exception.</p>
|
610
|
-
</td>
|
618
|
+
<td><p>Should Bunny's consumer work pool threads abort on exception.</p></td>
|
611
619
|
</tr>
|
612
|
-
|
613
620
|
<tr>
|
614
621
|
<td><tt>consumer_tag_prefix</tt></td>
|
615
622
|
<td>hutch</td>
|
616
623
|
<td>String</td>
|
617
624
|
<td><tt>HUTCH_CONSUMER_TAG_PREFIX</tt></td>
|
618
|
-
<td><p>Prefix displayed on the consumers tags.</p>
|
619
|
-
</td>
|
625
|
+
<td><p>Prefix displayed on the consumers tags.</p></td>
|
620
626
|
</tr>
|
621
|
-
|
622
627
|
</tbody>
|
623
628
|
</table>
|
624
|
-
|
625
|
-
|
626
|
-
---
|
627
|
-
|
628
|
-
GoCardless ♥ open source. If you do too, come [join us](https://gocardless.com/jobs/backend_developer).
|