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 +4 -4
- data/.travis.yml +2 -1
- data/CHANGELOG.md +4 -0
- data/features/CHANGELOG.md +4 -0
- data/lib/message_driver/adapters/bunny_adapter.rb +7 -3
- data/lib/message_driver/version.rb +1 -1
- data/spec/integration/bunny/bunny_adapter_spec.rb +22 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37e87665e5236aa222f318953697cdd22afb4db9
|
4
|
+
data.tar.gz: 3ad5849abc80a63269e6425a3c4c81cc06694be4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 484d9c907162ac6b4b23829293daa8ee15e852104f823549306f8437448ecd34ff3e4b3f00c8aa2e07cb35a921e913fdac8ba0a6a70a02e21db33979d4441d84
|
7
|
+
data.tar.gz: 8885281a32669a94934c10e545663ee4a2888655b104bf0182edf90aff2d424c32f53447e53f1c9778c72249c8e7176651523c80770a9e8af9ad2af00cc3306e
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/features/CHANGELOG.md
CHANGED
@@ -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
|
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
|
-
|
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(
|
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
|
@@ -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.
|
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-
|
11
|
+
date: 2014-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|