advanced-sneakers-activejob 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -1
- data/README.md +7 -1
- data/lib/advanced_sneakers_activejob/support/locate_workers_by_queues.rb +13 -4
- data/lib/advanced_sneakers_activejob/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 818f3505d0e58ddf098ed2884db036a0e16019e04641e6c8ca457e8c48850910
|
4
|
+
data.tar.gz: 374b620fbb9092a3c24547d6c036b6da0973e0059ce910cca559e7dae59eb028
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc3de6bfbd43c907c242ac65104e7cd91523930f209e216511ad4877dbd0ac836d51d291c71eb776559eb1b5d3667236d36f6641a5255652f7be33dbb07bc820
|
7
|
+
data.tar.gz: 6dcc9e3426e5592738c44d3f9feb658ba57e17713ed185bf3f76b9cc6df7d2886064abd031efc8a3913c9b41c5dfff89671f59809af42c42b018e4b5d1d40bfb
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## Changes Between 0.3.3 and 0.3.4
|
2
|
+
|
3
|
+
### [Support for wildcards to run ActiveJob consumers by queues](https://github.com/veeqo/advanced-sneakers-activejob/pull/10)
|
4
|
+
|
5
|
+
Works with `sneakers:active_job` task only!
|
6
|
+
|
7
|
+
```sh
|
8
|
+
QUEUES=mailers,index.*,telemetery.# rake sneakers:active_job
|
9
|
+
```
|
10
|
+
|
1
11
|
## Changes Between 0.3.2 and 0.3.3
|
2
12
|
|
3
13
|
### [Add ability to run ActiveJob consumers by queues](https://github.com/veeqo/advanced-sneakers-activejob/pull/9)
|
@@ -5,7 +15,7 @@
|
|
5
15
|
Works with `sneakers:active_job` task only!
|
6
16
|
|
7
17
|
```sh
|
8
|
-
rake sneakers:active_job
|
18
|
+
QUEUES=mailers,default rake sneakers:active_job
|
9
19
|
```
|
10
20
|
|
11
21
|
## Changes Between 0.3.1 and 0.3.2
|
data/README.md
CHANGED
@@ -41,7 +41,13 @@ rake sneakers:active_job
|
|
41
41
|
|
42
42
|
Run worker for picked queues of ActiveJob
|
43
43
|
```sh
|
44
|
-
|
44
|
+
QUEUES=mailers,foo,bar rake sneakers:active_job
|
45
|
+
```
|
46
|
+
|
47
|
+
Wildcards are supported for queues names with "words" (separator is `.`). Algorithm is similar to the way the [topic exchange matches routing keys](https://www.rabbitmq.com/tutorials/tutorial-five-python.html). `*` (star) substitutes for exactly one word. `#` (hash) substitutes for zero or more words
|
48
|
+
|
49
|
+
```sh
|
50
|
+
QUEUES=mailers,index.*,telemetery.# rake sneakers:active_job
|
45
51
|
```
|
46
52
|
|
47
53
|
## Unrouted messages
|
@@ -13,7 +13,7 @@ module AdvancedSneakersActiveJob
|
|
13
13
|
detect_workers_for_queues!
|
14
14
|
ensure_all_workers_found!
|
15
15
|
|
16
|
-
@workers
|
16
|
+
@workers.uniq
|
17
17
|
end
|
18
18
|
|
19
19
|
private
|
@@ -30,15 +30,24 @@ module AdvancedSneakersActiveJob
|
|
30
30
|
|
31
31
|
def detect_workers_for_queues!
|
32
32
|
@queues.each do |queue|
|
33
|
-
|
33
|
+
matching_workers = all_workers.select { |klass| klass.queue_name.match?(queue_regex(queue)) }
|
34
34
|
|
35
|
-
if
|
36
|
-
@workers
|
35
|
+
if matching_workers.any?
|
36
|
+
@workers += matching_workers
|
37
37
|
else
|
38
38
|
@queues_without_workers << queue
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
42
|
+
|
43
|
+
# https://www.rabbitmq.com/tutorials/tutorial-five-python.html
|
44
|
+
def queue_regex(queue)
|
45
|
+
regex = Regexp.escape(queue)
|
46
|
+
.gsub(/\A\\\*|(\.)\\\*/, '\1[^\.]+') # "*" (star) substitutes for exactly one word
|
47
|
+
.sub('\.\#', '(\.[^\.]+)*') # "#" (hash) substitutes for zero or more words
|
48
|
+
|
49
|
+
Regexp.new(['\A', regex, '\z'].join)
|
50
|
+
end
|
42
51
|
end
|
43
52
|
end
|
44
53
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: advanced-sneakers-activejob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rustam Sharshenov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-06-
|
12
|
+
date: 2020-06-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activejob
|