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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b15f6450fc13837c238c851ec2601a22014af4c9
4
- data.tar.gz: 0ae589054e73a758e3bd7192ff48aa0bf4c58914
3
+ metadata.gz: 810c3766a5dca1d09e230dd2fa33b2cfc2f17a6e
4
+ data.tar.gz: 907a549065e1ae8013cfa6738466c92dbaa5e4ef
5
5
  SHA512:
6
- metadata.gz: 5f33c6d5cf3c3fd673070f9ab7c3c4f7b60e94759f4be2bde99ab70e96b83405afc542b11ec55b084aa5240468f53769fa66d2b1853e5534c587a159237b01f1
7
- data.tar.gz: e838b8e2d6ec8c8d75dd759f6687af5c92f20d4e2fd0967c7c902479d48fd440fdacc0d66674a1387c22f040c39702a87cb48516040e753bc7c5c0b0721d8c57
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.assert_valid_keys(:managed_acking, :worker_count)
45
+ worker_options = worker_options.dup
46
46
 
47
- worker = Pebbles::River::Worker.new(listener,
48
- queue: queue_spec,
49
- managed_acking: worker_options[:managed_acking],
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
- name = queue_spec[:name]
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
@@ -1,5 +1,5 @@
1
1
  module Pebbles
2
2
  module River
3
- VERSION = '0.2.5'
3
+ VERSION = '0.2.6'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pebbles-river
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Staubo