multiple_man 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/lib/multiple_man/configuration.rb +2 -1
- data/lib/multiple_man/connection.rb +1 -1
- data/lib/multiple_man/consumers/general.rb +1 -1
- data/lib/multiple_man/version.rb +1 -1
- data/spec/connection_spec.rb +4 -2
- data/spec/consumers/general_spec.rb +7 -2
- 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: d92ba04f6fe9404dd98ce8c89addb6bbd11a3011
|
4
|
+
data.tar.gz: f5cd19e11c8cb204e0be5da36c0ac58fbeb6dad0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3718e17f9e5fc958ef18d30d870319569a909508980de9922dfdb076a304390fc2c6e2caaa13ce32555579effa937c2fff8ad12f18a2b9e1b3533a4fb423ac96
|
7
|
+
data.tar.gz: fe756d81f72831b3db89064ed7e0f3749823bf47a76d210f53c0f05c8da8b4bf782f2e6e611e3b1fcc59a327a561f9da86b1804fb5a82d8e376baf7d7b0751c6
|
data/README.md
CHANGED
@@ -58,6 +58,11 @@ calling MultipleMan.configure like so:
|
|
58
58
|
tls_ca_certificates: ['/usr/lib/ssl/certs/cacert.pem']
|
59
59
|
}
|
60
60
|
|
61
|
+
# Add opts that are used when creating the exchange
|
62
|
+
config.exchange_opts = {
|
63
|
+
durable: true
|
64
|
+
}
|
65
|
+
|
61
66
|
# Where you want to log errors to. Should be an instance of Logger
|
62
67
|
# Defaults to the Rails logger (for Rails) or STDOUT otherwise.
|
63
68
|
config.logger = Logger.new(STDOUT)
|
@@ -11,7 +11,7 @@ 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
|
14
|
+
:queue_name, :prefetch_size, :bunny_opts, :exchange_opts
|
15
15
|
|
16
16
|
attr_writer :logger
|
17
17
|
|
@@ -28,6 +28,7 @@ module MultipleMan
|
|
28
28
|
max_retries: 5
|
29
29
|
}
|
30
30
|
self.bunny_opts = {}
|
31
|
+
self.exchange_opts = {}
|
31
32
|
|
32
33
|
@subscriber_registry = Subscribers::Registry.new
|
33
34
|
end
|
@@ -42,7 +42,7 @@ module MultipleMan
|
|
42
42
|
begin
|
43
43
|
raise ConsumerError
|
44
44
|
rescue => wrapped_ex
|
45
|
-
MultipleMan.logger.debug "\
|
45
|
+
MultipleMan.logger.debug "\t#{wrapped_ex.class} #{wrapped_ex.cause.message} \n#{wrapped_ex.cause.backtrace}"
|
46
46
|
MultipleMan.error(wrapped_ex, reraise: false, payload: message, delivery_info: delivery_info)
|
47
47
|
queue.channel.nack(delivery_info.delivery_tag)
|
48
48
|
end
|
data/lib/multiple_man/version.rb
CHANGED
data/spec/connection_spec.rb
CHANGED
@@ -10,10 +10,12 @@ describe MultipleMan::Connection do
|
|
10
10
|
MultipleMan::Connection.reset!
|
11
11
|
end
|
12
12
|
|
13
|
-
it "should open a connection and a channel" do
|
13
|
+
it "should open a connection and a channel with opts" do
|
14
|
+
MultipleMan.configuration.exchange_opts = {durable: true, another: 'opt'}
|
15
|
+
|
14
16
|
MultipleMan::Connection.should_receive(:connection).and_return(mock_bunny)
|
15
17
|
mock_bunny.should_receive(:create_channel).once.and_return(mock_channel)
|
16
|
-
expect(mock_channel).to receive(:topic).with(MultipleMan.configuration.topic_name)
|
18
|
+
expect(mock_channel).to receive(:topic).with(MultipleMan.configuration.topic_name, durable: true, another: 'opt')
|
17
19
|
|
18
20
|
described_class.connect { }
|
19
21
|
end
|
@@ -89,17 +89,22 @@ describe MultipleMan::Consumers::General do
|
|
89
89
|
|
90
90
|
it 'wraps errors in ConsumerError' do
|
91
91
|
channel = double(Bunny::Channel)
|
92
|
-
queue
|
92
|
+
queue = double(Bunny::Queue, channel: channel).as_null_object
|
93
|
+
error = ArgumentError.new("undefined method `foo' for nil:NilClass")
|
94
|
+
error.set_backtrace(["file.rb:1 'foo'"])
|
93
95
|
|
94
96
|
delivery_info = OpenStruct.new(routing_key: "multiple_man.SomeClass.create")
|
95
97
|
payload = '{"a":1,"b":2}'
|
96
98
|
allow(queue).to receive(:subscribe).and_yield(delivery_info, double(:meta), payload)
|
97
99
|
|
98
100
|
subscriber = listener1.new
|
99
|
-
allow(subscriber).to receive(:create).and_raise(
|
101
|
+
allow(subscriber).to receive(:create).and_raise(error)
|
100
102
|
|
101
103
|
allow(channel).to receive(:nack)
|
102
104
|
|
105
|
+
expect(MultipleMan.logger).to receive(:debug).with('Starting listeners.')
|
106
|
+
expect(MultipleMan.logger).to receive(:debug).with('Processing message for multiple_man.SomeClass.create.')
|
107
|
+
expect(MultipleMan.logger).to receive(:debug).with("\tMultipleMan::ConsumerError #{error.message} \n#{error.backtrace}")
|
103
108
|
expect(MultipleMan).to receive(:error).with(kind_of(MultipleMan::ConsumerError), kind_of(Hash))
|
104
109
|
subject = described_class.new(subscribers:[subscriber], queue: queue, topic: 'some-topic')
|
105
110
|
subject.listen
|
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.3.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-
|
11
|
+
date: 2017-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|