govuk_message_queue_consumer 4.0.0 → 4.2.0
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0afd12a5a1835a2c0b084462729846009ff2db28ac4315297cdbc1120beb0a3a
|
4
|
+
data.tar.gz: '0567349e9ff36b486384d21280dec6102d92285dd6971e75dd548d892b9e5383'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1061fe3d8164cb1d33cff988224cae58b3a8b2b3a8fc71d21657371e106b5c831ab51625f8cc7f6e1db4b32f717cc7806d34fa3b7cf0ec8422a8bf4b6bcaca00
|
7
|
+
data.tar.gz: 860de89747df830547fac9ee2702a13adc36d218c23cfbb430a6f9992fe8cd69865e97bc9597f9e603e1bd4a325fd357421fee86786eb2078d3db3445a9b1c0e
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
# 4.2.0
|
2
|
+
|
3
|
+
* Drop support for Ruby 3.0. The minimum required Ruby version is now 3.1.4.
|
4
|
+
* Add support for Ruby 3.3.
|
5
|
+
- Drop support for Ruby 2.7.
|
6
|
+
- Fix ability to handle system signals, and report non-`SIGTERM` errors to `GovukError`
|
7
|
+
|
8
|
+
# 4.1.0
|
9
|
+
|
10
|
+
- Support configuration via
|
11
|
+
[`RABBITMQ_URL`](https://github.com/ruby-amqp/bunny/blob/066496d8/docs/guides/connecting.md#the-rabbitmq_url-environment-variable)
|
12
|
+
instead of `RABBITMQ_HOSTS`, `RABBITMQ_VHOST`, `RABBITMQ_USER` and
|
13
|
+
`RABBITMQ_PASSWORD`, which are deprecated and will be removed in a later
|
14
|
+
version.
|
15
|
+
- Update [bunny](https://github.com/ruby-amqp/bunny/) from 2.11 to 2.17, which
|
16
|
+
is the last version that supports Ruby 2.7. See [Bunny
|
17
|
+
changelog](https://github.com/ruby-amqp/bunny/blob/main/ChangeLog.md#changes-between-bunny-216x-and-2170-sep-11th-2020).
|
18
|
+
|
1
19
|
# 4.0.0
|
2
20
|
|
3
21
|
- Breaking: remove batch consumer ([#73](https://github.com/alphagov/govuk_message_queue_consumer/pull/73))
|
@@ -21,7 +39,7 @@
|
|
21
39
|
# 3.2.0
|
22
40
|
|
23
41
|
- Add batch process capabilities
|
24
|
-
- Refactor `process_chain` to `message_consumer`
|
42
|
+
- Refactor `process_chain` to `message_consumer`
|
25
43
|
|
26
44
|
# 3.1.0
|
27
45
|
|
data/README.md
CHANGED
@@ -14,10 +14,10 @@ For detailed documentation, check out the [gem documentation on rubydoc.info](ht
|
|
14
14
|
|
15
15
|
This gem is used by:
|
16
16
|
|
17
|
-
- [Cache clearing service](https://github.com/alphagov/cache-clearing-service).
|
18
17
|
- [Content Data API](https://github.com/alphagov/content-data-api).
|
19
18
|
- [Email Alert Service](https://github.com/alphagov/email-alert-service/).
|
20
19
|
- [Search API](https://github.com/alphagov/search-api).
|
20
|
+
- [Search API v2](https://github.com/alphagov/search-api-v2).
|
21
21
|
|
22
22
|
## Overview of RabbitMQ
|
23
23
|
|
@@ -57,15 +57,15 @@ end
|
|
57
57
|
|
58
58
|
More options are [documented here](http://www.rubydoc.info/gems/govuk_message_queue_consumer/GovukMessageQueueConsumer/Consumer#initialize-instance_method).
|
59
59
|
|
60
|
-
The consumer expects
|
61
|
-
|
60
|
+
The consumer expects the [`RABBITMQ_URL` environment
|
61
|
+
variable](https://github.com/ruby-amqp/bunny/blob/066496d/docs/guides/connecting.md#paas-environments)
|
62
|
+
to be set to an AMQP connection string, for example:
|
62
63
|
|
63
|
-
|
64
|
-
|
65
|
-
RABBITMQ_VHOST
|
66
|
-
RABBITMQ_USER
|
67
|
-
|
68
|
-
```
|
64
|
+
`RABBITMQ_URL=amqp://mrbean:hunter2@rabbitmq.example.com:5672`
|
65
|
+
|
66
|
+
The GOV.UK-specific environment variables `RABBITMQ_HOSTS`, `RABBITMQ_VHOST`,
|
67
|
+
`RABBITMQ_USER` and `RABBITMQ_PASSWORD` are deprecated. Support for these will
|
68
|
+
be removed in a future version of govuk_message_queue_consumer.
|
69
69
|
|
70
70
|
Define a class that will process the messages:
|
71
71
|
|
@@ -11,7 +11,12 @@ module GovukMessageQueueConsumer
|
|
11
11
|
NUMBER_OF_MESSAGES_TO_PREFETCH = 1
|
12
12
|
|
13
13
|
def self.default_connection_from_env
|
14
|
-
|
14
|
+
# https://github.com/ruby-amqp/bunny/blob/066496d/docs/guides/connecting.md#paas-environments
|
15
|
+
if !ENV["RABBITMQ_URL"].to_s.empty?
|
16
|
+
Bunny.new
|
17
|
+
else
|
18
|
+
Bunny.new(RabbitMQConfig.from_environment(ENV))
|
19
|
+
end
|
15
20
|
end
|
16
21
|
|
17
22
|
# Create a new consumer
|
@@ -39,15 +44,16 @@ module GovukMessageQueueConsumer
|
|
39
44
|
@statsd_client.increment("#{@queue_name}.started")
|
40
45
|
message_consumer.process(message)
|
41
46
|
@statsd_client.increment("#{@queue_name}.#{message.status}")
|
42
|
-
rescue SignalException => e
|
43
|
-
@logger.error "SignalException in processor: \n\n #{e.class}: #{e.message}\n\n#{e.backtrace.join("\n")}"
|
44
|
-
exit(1) # Ensure rabbitmq requeues outstanding messages
|
45
47
|
rescue StandardError => e
|
46
48
|
@statsd_client.increment("#{@queue_name}.uncaught_exception")
|
47
49
|
GovukError.notify(e) if defined?(GovukError)
|
48
50
|
@logger.error "Uncaught exception in processor: \n\n #{e.class}: #{e.message}\n\n#{e.backtrace.join("\n")}"
|
49
51
|
exit(1) # Ensure rabbitmq requeues outstanding messages
|
50
52
|
end
|
53
|
+
rescue SignalException => e
|
54
|
+
GovukError.notify(e) if defined?(GovukError) && e.message != "SIGTERM"
|
55
|
+
|
56
|
+
exit
|
51
57
|
end
|
52
58
|
|
53
59
|
private
|
@@ -9,7 +9,6 @@ module GovukMessageQueueConsumer
|
|
9
9
|
vhost: fetch(env, "RABBITMQ_VHOST"),
|
10
10
|
user: fetch(env, "RABBITMQ_USER"),
|
11
11
|
pass: fetch(env, "RABBITMQ_PASSWORD"),
|
12
|
-
recover_from_connection_close: true,
|
13
12
|
}
|
14
13
|
end
|
15
14
|
|
@@ -22,7 +21,9 @@ module GovukMessageQueueConsumer
|
|
22
21
|
The environment variable #{variable_name} is not set. If you are in test
|
23
22
|
mode, make sure you set the correct vars in your helpers. If you get this
|
24
23
|
error in development, make sure you run rails or rake with `govuk_setenv`
|
25
|
-
and puppet is up to date.
|
24
|
+
and puppet is up to date. RABBITMQ_HOSTS, RABBITMQ_VHOST,
|
25
|
+
RABBITMQ_USER and RABBITMQ_PASSWORD are deprecated. Please switch to
|
26
|
+
RABBITMQ_URL.
|
26
27
|
ERR
|
27
28
|
end
|
28
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_message_queue_consumer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.17'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.17'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bunny-mock
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - '='
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 4.
|
89
|
+
version: 4.16.1
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 4.
|
96
|
+
version: 4.16.1
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: yard
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -141,14 +141,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
141
141
|
requirements:
|
142
142
|
- - ">="
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version:
|
144
|
+
version: 3.1.4
|
145
145
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
146
|
requirements:
|
147
147
|
- - ">="
|
148
148
|
- !ruby/object:Gem::Version
|
149
149
|
version: '0'
|
150
150
|
requirements: []
|
151
|
-
rubygems_version: 3.
|
151
|
+
rubygems_version: 3.5.9
|
152
152
|
signing_key:
|
153
153
|
specification_version: 4
|
154
154
|
summary: AMQP message queue consumption with GOV.UK conventions
|