multiple_man 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/multiple_man.rb +2 -0
- data/lib/multiple_man/configuration.rb +3 -1
- data/lib/multiple_man/connection.rb +2 -1
- data/lib/multiple_man/model_publisher.rb +2 -2
- data/lib/multiple_man/version.rb +1 -1
- data/spec/model_publisher_spec.rb +12 -6
- 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: c8569fbeb2332b746b624b89ca693b82fafbbbd8
|
4
|
+
data.tar.gz: 22546e311063337f0570896f2ed40387547a6135
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ca8387c22e2ca8665d4cf90f5e990dea472d7a46b1a448540e8adb01af6d8c759c358c2ca5505e1005a03e49aba257cd5df6fb93d050e0478211881318e3736
|
7
|
+
data.tar.gz: 0e022910a4b70baea88d04092bebabbbf4b90a7a34cc34f7c2e1d013d5d85d9e34aca2569eb4bba0e747520da1a4d6e94fd45b36e425575bb3c096db72f257b9
|
data/lib/multiple_man.rb
CHANGED
@@ -11,7 +11,8 @@ module MultipleMan
|
|
11
11
|
attr_reader :subscriber_registry
|
12
12
|
attr_accessor :topic_name, :app_name, :connection, :enabled, :error_handler,
|
13
13
|
:worker_concurrency, :reraise_errors, :connection_recovery,
|
14
|
-
:queue_name, :prefetch_size, :bunny_opts, :exchange_opts
|
14
|
+
:queue_name, :prefetch_size, :bunny_opts, :exchange_opts,
|
15
|
+
:publisher_confirms
|
15
16
|
|
16
17
|
attr_writer :logger
|
17
18
|
|
@@ -29,6 +30,7 @@ module MultipleMan
|
|
29
30
|
}
|
30
31
|
self.bunny_opts = {}
|
31
32
|
self.exchange_opts = {}
|
33
|
+
self.publisher_confirms = false
|
32
34
|
|
33
35
|
@subscriber_registry = Subscribers::Registry.new
|
34
36
|
end
|
@@ -21,7 +21,7 @@ module MultipleMan
|
|
21
21
|
retry
|
22
22
|
else
|
23
23
|
Thread.current[:multiple_man_exception_retry_count] = 0
|
24
|
-
raise
|
24
|
+
raise ConnectionError, e
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -29,6 +29,7 @@ module MultipleMan
|
|
29
29
|
Thread.current.thread_variable_get(:multiple_man_current_channel) || begin
|
30
30
|
channel = connection.create_channel
|
31
31
|
channel_gc.push(channel)
|
32
|
+
channel.confirm_select if MultipleMan.configuration.publisher_confirms
|
32
33
|
Thread.current.thread_variable_set(:multiple_man_current_channel, channel)
|
33
34
|
|
34
35
|
channel
|
@@ -20,7 +20,8 @@ module MultipleMan
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
rescue Exception => ex
|
23
|
-
|
23
|
+
err = ProducerError.new(reason: ex, payload: records.inspect)
|
24
|
+
MultipleMan.error(err, reraise: false)
|
24
25
|
end
|
25
26
|
|
26
27
|
private
|
@@ -45,6 +46,5 @@ module MultipleMan
|
|
45
46
|
yield records
|
46
47
|
end
|
47
48
|
end
|
48
|
-
|
49
49
|
end
|
50
50
|
end
|
data/lib/multiple_man/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe MultipleMan::ModelPublisher do
|
3
|
+
describe MultipleMan::ModelPublisher do
|
4
4
|
let(:channel_stub) { double(Bunny::Channel, topic: topic_stub)}
|
5
5
|
let(:topic_stub) { double(Bunny::Exchange, publish: nil) }
|
6
6
|
|
@@ -35,10 +35,17 @@ describe MultipleMan::ModelPublisher do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should call the error handler on error" do
|
38
|
-
|
38
|
+
records = MockObject.new
|
39
|
+
mock_error = MultipleMan::ProducerError.new
|
40
|
+
ex = Exception.new("Bad stuff happened")
|
41
|
+
|
39
42
|
topic_stub.stub(:publish) { raise ex }
|
40
|
-
MultipleMan.should_receive(:error).with(
|
41
|
-
|
43
|
+
MultipleMan.should_receive(:error).with(mock_error, reraise: false)
|
44
|
+
MultipleMan::ProducerError.should_receive(
|
45
|
+
:new
|
46
|
+
).with(reason: ex, payload: records.inspect).and_return(mock_error)
|
47
|
+
|
48
|
+
described_class.new(fields: [:foo]).publish(records)
|
42
49
|
end
|
43
50
|
end
|
44
51
|
|
@@ -59,5 +66,4 @@ describe MultipleMan::ModelPublisher do
|
|
59
66
|
subject.publish(obj)
|
60
67
|
end
|
61
68
|
end
|
62
|
-
|
63
|
-
end
|
69
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multiple_man
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Brunner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|