pebbles-river 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pebbles/river/supervisor.rb +11 -9
- data/lib/pebbles/river/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 810c3766a5dca1d09e230dd2fa33b2cfc2f17a6e
|
4
|
+
data.tar.gz: 907a549065e1ae8013cfa6738466c92dbaa5e4ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea19b805fe8d0c09f826a0cd6f52bdf155173d2c530347fa04c487baecd7a2924a1aac866b1dfb0fccfbde1c2de18790631c416566157ff6125b431256aee347
|
7
|
+
data.tar.gz: 117fcfcf720e0de40ed98f6f37f0b1a9bf037748fcb9e1e8de84039dc3e9e9d0a21ef791b5fa8ef66626523471607f4ceced93cbce692ad47f7b3dd347b82df3
|
@@ -35,31 +35,33 @@ module Pebbles
|
|
35
35
|
|
36
36
|
# Add a listener. The listener must support the `#call(message)` method.
|
37
37
|
# The queue specification contains the parameters naming the queue and
|
38
|
-
# so on; see `Pebbles::River::River#queue`. The worker options
|
38
|
+
# so on; see `Pebbles::River::River#queue`. The worker options are the
|
39
|
+
# same as those used by `Pebbles::River::Worker.new`, plus:
|
39
40
|
#
|
40
|
-
# * `managed_acking`: Passed along to `Pebbles::River::Worker.new`.
|
41
41
|
# * `worker_count`: Number of parallel workers to run. Defaults to the
|
42
42
|
# global setting.
|
43
43
|
#
|
44
44
|
def add_listener(listener, queue_spec, worker_options = {})
|
45
|
-
worker_options.
|
45
|
+
worker_options = worker_options.dup
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
47
|
+
worker_count = worker_options.delete(:worker_count) || @worker_count
|
48
|
+
|
49
|
+
worker_options = {
|
50
50
|
on_exception: ->(e) {
|
51
51
|
if logger.respond_to?(:exception)
|
52
52
|
logger.exception(e)
|
53
53
|
else
|
54
54
|
logger.error("Exception #{e.class}: #{e} #{e.backtrace.join("\n")}")
|
55
55
|
end
|
56
|
-
}
|
56
|
+
}
|
57
|
+
}.merge(worker_options)
|
58
|
+
worker_options[:queue] = queue_spec
|
57
59
|
|
58
|
-
|
60
|
+
worker = Pebbles::River::Worker.new(listener, worker_options)
|
59
61
|
|
62
|
+
name = queue_spec[:name]
|
60
63
|
process_name = "#{@name}: queue worker: #{name}"
|
61
64
|
logger = @logger
|
62
|
-
worker_count = worker_options[:worker_count] || @worker_count
|
63
65
|
|
64
66
|
@worker_modules.push([name, worker_count, Module.new {
|
65
67
|
define_method :execute do
|