pebbles-river 0.2.4 → 0.2.5

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: d32bde8fa9fda574c90b46eb57b4ba364c5b68c6
4
- data.tar.gz: 3c2f0979ed03caf0de9893201fc98344825da04f
3
+ metadata.gz: b15f6450fc13837c238c851ec2601a22014af4c9
4
+ data.tar.gz: 0ae589054e73a758e3bd7192ff48aa0bf4c58914
5
5
  SHA512:
6
- metadata.gz: 3e314037ba91d991761aa4664d093e8506ca40a3bbc7d6ea31456df723d17414a55402f84b99e4f14d8d2fa736afbdbf90a216f4025d569184004e928b10e458
7
- data.tar.gz: 012b3685483b463b74cfc49db26a28a1095726c647d1a4bb875cfd52040e77c02960b2be2cb5afdfafaf732afa6bad03cf8fb8a717aea0ece517735a483e8914
6
+ metadata.gz: 5f33c6d5cf3c3fd673070f9ab7c3c4f7b60e94759f4be2bde99ab70e96b83405afc542b11ec55b084aa5240468f53769fa66d2b1853e5534c587a159237b01f1
7
+ data.tar.gz: e838b8e2d6ec8c8d75dd759f6687af5c92f20d4e2fd0967c7c902479d48fd440fdacc0d66674a1387c22f040c39702a87cb48516040e753bc7c5c0b0721d8c57
@@ -7,12 +7,14 @@ module Pebbles
7
7
  attr_reader :exchange
8
8
  attr_reader :session
9
9
  attr_reader :channel
10
+ attr_reader :prefetch
10
11
 
11
12
  def initialize(options = {})
12
13
  options = {environment: options} if options.is_a?(String) # Backwards compatibility
13
14
 
14
15
  @environment = (options[:environment] || ENV['RACK_ENV'] || 'development').dup.freeze
15
16
  @last_connect_attempt = nil
17
+ @prefetch = options[:prefetch]
16
18
  end
17
19
 
18
20
  def connected?
@@ -27,6 +29,7 @@ module Pebbles
27
29
  session.start
28
30
 
29
31
  channel = session.create_channel
32
+ channel.prefetch(@prefetch) if @prefetch
30
33
 
31
34
  exchange = channel.exchange(exchange_name, EXCHANGE_OPTIONS.dup)
32
35
 
@@ -1,5 +1,5 @@
1
1
  module Pebbles
2
2
  module River
3
- VERSION = '0.2.4'
3
+ VERSION = '0.2.5'
4
4
  end
5
5
  end
@@ -25,6 +25,7 @@ module Pebbles
25
25
  # is automatically acked unless the handler returns false or the handler
26
26
  # raises an exception, in which case it's nacked. If false, the handler
27
27
  # must do the ack/nacking. Defaults to true.
28
+ # * `prefetch`: If specified, sets channel's prefetch count.
28
29
  #
29
30
  # The handler must implement `call(payload, extra)`, where the payload is
30
31
  # the message payload, and the extra argument contains message metadata as
@@ -36,7 +37,8 @@ module Pebbles
36
37
  :queue,
37
38
  :logger,
38
39
  :on_exception,
39
- :managed_acking)
40
+ :managed_acking,
41
+ :prefetch)
40
42
 
41
43
  unless handler.respond_to?(:call)
42
44
  raise ArgumentError.new('Handler must implement #call protocool')
@@ -50,7 +52,7 @@ module Pebbles
50
52
  end
51
53
  @on_exception = options[:on_exception] || ->(*args) { }
52
54
  @handler = handler
53
- @river = River.new
55
+ @river = River.new(options.slice(:prefetch))
54
56
  @next_event_time = Time.now
55
57
  @rate_limiter = RateLimiter.new(1.0, 10)
56
58
  @logger = options.fetch(:logger, Logger.new($stderr))
@@ -8,7 +8,7 @@ require 'spec_helper'
8
8
  describe Pebbles::River::River do
9
9
 
10
10
  subject do
11
- Pebbles::River::River.new('whatever')
11
+ Pebbles::River::River.new(environment: 'whatever')
12
12
  end
13
13
 
14
14
  CONNECTION_EXCEPTIONS = [
@@ -42,7 +42,7 @@ describe Pebbles::River::River do
42
42
  end
43
43
 
44
44
  context "in production" do
45
- subject { Pebbles::River::River.new('production') }
45
+ subject { Pebbles::River::River.new(environment: 'production') }
46
46
 
47
47
  it "doesn't append the thing" do
48
48
  subject.connect
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.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Staubo
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-05-06 00:00:00.000000000 Z
12
+ date: 2015-08-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pebblebed
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
187
  version: '0'
188
188
  requirements: []
189
189
  rubyforge_project:
190
- rubygems_version: 2.2.2
190
+ rubygems_version: 2.4.6
191
191
  signing_key:
192
192
  specification_version: 4
193
193
  summary: Implements an event river mechanism for Pebblebed.