message-driver 0.5.1 → 0.5.2

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: 50d3e0ad81f5bd85c9bbedffba83a385e3eacbbb
4
- data.tar.gz: 10e8e998f50aeaf99cd309d413846945d6574792
3
+ metadata.gz: 37e87665e5236aa222f318953697cdd22afb4db9
4
+ data.tar.gz: 3ad5849abc80a63269e6425a3c4c81cc06694be4
5
5
  SHA512:
6
- metadata.gz: 2a41aa665e9b2598d13815f7a0968ee16c3d2dd00ca49548b2115633e4e1556576e1c94d5bb3e86c43dbf5cef9459da6375eee2372ffab72ddd1711ac88a4327
7
- data.tar.gz: 15baeb722f77d49dd2aedb4de7b4f20c13835a7944d646b106fc2168b590b8561dec4a34b148a0a61039ec40588855dd02c2463750b3d7cabddbf6096637574e
6
+ metadata.gz: 484d9c907162ac6b4b23829293daa8ee15e852104f823549306f8437448ecd34ff3e4b3f00c8aa2e07cb35a921e913fdac8ba0a6a70a02e21db33979d4441d84
7
+ data.tar.gz: 8885281a32669a94934c10e545663ee4a2888655b104bf0182edf90aff2d424c32f53447e53f1c9778c72249c8e7176651523c80770a9e8af9ad2af00cc3306e
data/.travis.yml CHANGED
@@ -17,7 +17,8 @@ env:
17
17
  - ADAPTER=in_memory
18
18
  - ADAPTER=bunny:1.2.2
19
19
  - ADAPTER=bunny:1.3.1
20
- - ADAPTER=bunny:1.4.0
20
+ - ADAPTER=bunny:1.4.1
21
+ - ADAPTER=bunny:1.5.0
21
22
  - ADAPTER=stomp
22
23
  matrix:
23
24
  allow_failures:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.2 - 2014-10-14
4
+
5
+ * fix deprecation warning with bunny 1.5.0
6
+
3
7
  ## 0.5.1 - 2014-10-08
4
8
 
5
9
  * put version constant under correct module
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.2 - 2014-10-14
4
+
5
+ * fix deprecation warning with bunny 1.5.0
6
+
3
7
  ## 0.5.1 - 2014-10-08
4
8
 
5
9
  * put version constant under correct module
@@ -150,7 +150,7 @@ module MessageDriver
150
150
  end
151
151
  @sub_ctx = adapter.new_subscription_context(self)
152
152
  @error_handler = options[:error_handler]
153
- @message_handler = case options[:ack]
153
+ @message_handler = case options.delete(:ack)
154
154
  when :auto, nil
155
155
  AutoAckHandler.new(self)
156
156
  when :manual
@@ -238,7 +238,8 @@ module MessageDriver
238
238
  @sub_ctx.with_channel do |ch|
239
239
  queue = destination.bunny_queue(@sub_ctx.channel)
240
240
  ch.prefetch(options[:prefetch_size]) if options.key? :prefetch_size
241
- @bunny_consumer = queue.subscribe(options.merge(manual_ack: true)) do |delivery_info, properties, payload|
241
+ sub_opts = options.merge(adapter.ack_key => true)
242
+ @bunny_consumer = queue.subscribe(sub_opts) do |delivery_info, properties, payload|
242
243
  adapter.broker.client.with_adapter_context(@sub_ctx) do
243
244
  message = @sub_ctx.args_to_message(delivery_info, properties, payload, destination)
244
245
  @message_handler.call(message)
@@ -252,8 +253,11 @@ module MessageDriver
252
253
  validate_bunny_version
253
254
  @broker = broker
254
255
  @config = config
256
+ @ack_key = Bunny::VERSION >= '1.5.0' ? :manual_ack : :ack
255
257
  end
256
258
 
259
+ attr_reader :ack_key
260
+
257
261
  def connection(ensure_started = true)
258
262
  if ensure_started
259
263
  begin
@@ -391,7 +395,7 @@ module MessageDriver
391
395
  with_channel(false) do |ch|
392
396
  queue = ch.queue(destination.name, passive: true)
393
397
 
394
- message = queue.pop(ack: options.fetch(:client_ack, false))
398
+ message = queue.pop(adapter.ack_key => options.fetch(:client_ack, false))
395
399
  if message.nil? || message[0].nil?
396
400
  nil
397
401
  else
@@ -1,3 +1,3 @@
1
1
  module MessageDriver
2
- VERSION = '0.5.1'
2
+ VERSION = '0.5.2'
3
3
  end
@@ -33,7 +33,7 @@ module MessageDriver
33
33
  include_examples 'raises an error'
34
34
  end
35
35
  end
36
- %w(1.2.2 1.3.2 1.4.0).each do |v|
36
+ %w(1.2.2 1.3.2 1.4.0 1.5.0).each do |v|
37
37
  context "bunny version #{v}" do
38
38
  let(:version) { v }
39
39
  include_examples "doesn't raise an error"
@@ -79,6 +79,27 @@ module MessageDriver
79
79
  include_context 'a connected bunny adapter'
80
80
  end
81
81
 
82
+ describe '#ack_key' do
83
+ include_context 'a connected bunny adapter'
84
+
85
+ context 'when bunny version is 1.5.0 or later' do
86
+ before do
87
+ stub_const('Bunny::VERSION', '1.5.0')
88
+ end
89
+ it 'should be :manual_ack' do
90
+ expect(adapter.ack_key).to eq(:manual_ack)
91
+ end
92
+ end
93
+ context 'when bunny version earlier than 1.5.0' do
94
+ before do
95
+ stub_const('Bunny::VERSION', '1.4.1')
96
+ end
97
+ it 'should be :manual_ack' do
98
+ expect(adapter.ack_key).to eq(:ack)
99
+ end
100
+ end
101
+ end
102
+
82
103
  describe '#new_context' do
83
104
  include_context 'a connected bunny adapter'
84
105
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: message-driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Campbell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-08 00:00:00.000000000 Z
11
+ date: 2014-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake