sanger_warren 0.3.0.pre.rc1 → 0.3.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 +4 -4
- data/.yardopts +3 -0
- data/CHANGELOG.md +4 -1
- data/Gemfile.lock +1 -1
- data/README.md +22 -0
- data/lib/warren/delay_exchange.rb +1 -1
- data/lib/warren/den.rb +3 -2
- data/lib/warren/framework_adaptor/rails_adaptor.rb +6 -5
- data/lib/warren/message/simple.rb +6 -0
- data/lib/warren/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07d40b65d949f1c9fe0a1622faab1cfc6e64483ef498400daae60d7dd17d4897
|
4
|
+
data.tar.gz: badadcd8587f75dd72cc240df07947a39a222741043525ed204efb7738b13511
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 333c5cb6382e1ac5cdf475a66e541afcaa0ca5698105cf8e62d435c8bbf2171e59f165875597d507c75b2b8a4eff8504a96f7d6295cf24f05a5393ac55c01716
|
7
|
+
data.tar.gz: de3d17ae3bdeaf272ca52a3f5170187efb570709ca77f77a657221400d1fcf50706d8d48c6aa48118bfb3f67276925412baaf4fe7fb250ef64abe1da02134267
|
data/.yardopts
ADDED
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,8 @@ Unreleased section to make new releases easy.
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [0.3.0] - 2021-06-04
|
9
|
+
|
8
10
|
### Added
|
9
11
|
|
10
12
|
- Added support for delay exchanges to process messages after a fixed delay
|
@@ -19,8 +21,9 @@ Unreleased section to make new releases easy.
|
|
19
21
|
|
20
22
|
## Changed
|
21
23
|
|
22
|
-
- Messages must now implement
|
24
|
+
- Messages must now implement `#headers`, although simply returning an empty
|
23
25
|
hash is sufficient.
|
26
|
+
See {Warren::Message::Simple#headers} for example
|
24
27
|
- Subscriber templates now use the path 'app/warren/subscriber' rather than
|
25
28
|
'app/warren/subscribers' to correctly match class namespacing.
|
26
29
|
- 3 consumer worker threads will be spun up by default
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -104,6 +104,28 @@ These options can be over-ridden in the warren_consumers.yml file if necessary.
|
|
104
104
|
If you wish to completely disable dead-letter queue configuration, such as when
|
105
105
|
using policies, then you can set dead_letters to false.
|
106
106
|
|
107
|
+
#### Delayed messaged
|
108
|
+
|
109
|
+
Warren uses a delay exchange / queue approach for delaying the redelivery of messages.
|
110
|
+
We don't currently support the
|
111
|
+
[delayed message exchange plugin](https://github.com/rabbitmq/rabbitmq-delayed-message-exchange)
|
112
|
+
|
113
|
+
The way this works:
|
114
|
+
|
115
|
+
- Consumers with a delay option will automatically register an exchange and a queue
|
116
|
+
- By default both of these will be named '<consumer_name>.delay' although you can
|
117
|
+
override this by updating `warren_consumers.yml`
|
118
|
+
- The '<consumer_name>.delay' queue will have a time-to-live (ttl) set, after
|
119
|
+
which any messages on the queue will be dead-lettered
|
120
|
+
- The dead-letter exchange for this queue is configured to an empty string `''`
|
121
|
+
which corresponds to the 'default exchange', and the routing key is set to
|
122
|
+
match the original queue name.
|
123
|
+
- This exchange is a little bit special, and automatically routes messages to
|
124
|
+
any queue on the host where the queue name matches the message routing key.
|
125
|
+
|
126
|
+
This approach avoids repeat delivery of the message to any other queues bound
|
127
|
+
to the original exchange, and avoids the need for further exchanges or bindings.
|
128
|
+
|
107
129
|
### Running consumers
|
108
130
|
|
109
131
|
To run all configure consumers use:
|
@@ -13,7 +13,7 @@ module Warren
|
|
13
13
|
attr_reader :channel
|
14
14
|
|
15
15
|
#
|
16
|
-
#
|
16
|
+
# Create a new delay exchange. Handles queue creation, binding and attaching
|
17
17
|
# consumers to the queues
|
18
18
|
#
|
19
19
|
# @param channel [Warren::Handler::Broadcast::Channel] A channel on which to register queues
|
data/lib/warren/den.rb
CHANGED
@@ -7,8 +7,9 @@ require 'warren/delay_exchange'
|
|
7
7
|
|
8
8
|
module Warren
|
9
9
|
# A Den is in charge of creating a Fox from a consumer configuration
|
10
|
-
#
|
11
|
-
#
|
10
|
+
# It handles the registration of dead-letter queues, and configuration of
|
11
|
+
# {Warren::Subscription subscriptions} and
|
12
|
+
# {Warren::DelayExchange delay exchanges}
|
12
13
|
class Den
|
13
14
|
# The number of simultaneous workers generated by default
|
14
15
|
DEFAULT_WORKER_COUNT = 3
|
@@ -2,30 +2,31 @@
|
|
2
2
|
|
3
3
|
module Warren
|
4
4
|
# Namespace for framework adaptors.
|
5
|
+
#
|
5
6
|
# A FrameworkAdaptor should implement the following instance methods:
|
6
7
|
#
|
7
|
-
|
8
|
+
# == recovered? => Bool
|
8
9
|
# Indicates that any temporary issues (such as database connectivity problems)
|
9
10
|
# are resolved and consumers may restart.
|
10
11
|
#
|
11
|
-
|
12
|
+
# == handle
|
12
13
|
#
|
13
14
|
# Wraps the processing of each message, is expected to `yield` to allow
|
14
15
|
# processing. May be responsible for handling connection pools, and
|
15
16
|
# framework-specific exceptions. Raising {Warren::Exceptions::TemporaryIssue}
|
16
17
|
# here will cause consumers to sleep until `recovered?` returns true.
|
17
18
|
#
|
18
|
-
|
19
|
+
# == env => String
|
19
20
|
#
|
20
21
|
# Returns the current environment of the application.
|
21
22
|
#
|
22
|
-
|
23
|
+
# == logger => Logger
|
23
24
|
#
|
24
25
|
# Returns your application logger. Is expected to be compatible with the
|
25
26
|
# standard library Logger class.
|
26
27
|
# @see https://ruby-doc.org/stdlib-2.7.0/libdoc/logger/rdoc/Logger.html
|
27
28
|
#
|
28
|
-
|
29
|
+
# == load_application
|
29
30
|
#
|
30
31
|
# Called upon running `warren consumer start`. Should ensure your application
|
31
32
|
# is correctly loaded sufficiently for processing messages
|
@@ -4,6 +4,12 @@ module Warren
|
|
4
4
|
# Namespace for Warren message wrappers.
|
5
5
|
module Message
|
6
6
|
# A simple message simply wraps the routing key and payload together
|
7
|
+
# @!attribute [rw] routing_key
|
8
|
+
# @return [String] The routing key of the message
|
9
|
+
# @!attribute [rw] payload
|
10
|
+
# @return [String] The payload of the message
|
11
|
+
# @!attribute [rw] headers
|
12
|
+
# @return [Hash] Hash of header attributes. Can be empty hash.
|
7
13
|
Simple = Struct.new(:routing_key, :payload, :headers)
|
8
14
|
end
|
9
15
|
end
|
data/lib/warren/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sanger_warren
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.0
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Glover
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- ".gitignore"
|
81
81
|
- ".rspec"
|
82
82
|
- ".rubocop.yml"
|
83
|
+
- ".yardopts"
|
83
84
|
- CHANGELOG.md
|
84
85
|
- Gemfile
|
85
86
|
- Gemfile.lock
|
@@ -150,9 +151,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
150
151
|
version: 2.6.0
|
151
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
153
|
requirements:
|
153
|
-
- - "
|
154
|
+
- - ">="
|
154
155
|
- !ruby/object:Gem::Version
|
155
|
-
version:
|
156
|
+
version: '0'
|
156
157
|
requirements: []
|
157
158
|
rubygems_version: 3.1.4
|
158
159
|
signing_key:
|