liebre 0.1.21 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/Gemfile.lock +9 -7
- data/{LICENSE → LICENSE.txt} +1 -1
- data/README.md +492 -195
- data/Rakefile +2 -0
- data/lib/liebre.rb +27 -16
- data/lib/liebre/actor.rb +11 -0
- data/lib/liebre/actor/consumer.rb +80 -0
- data/lib/liebre/actor/consumer/callback.rb +34 -0
- data/lib/liebre/actor/consumer/core.rb +80 -0
- data/lib/liebre/actor/consumer/reporter.rb +84 -0
- data/lib/liebre/actor/consumer/resources.rb +47 -0
- data/lib/liebre/actor/consumer/resources/config.rb +65 -0
- data/lib/liebre/actor/context.rb +40 -0
- data/lib/liebre/actor/context/declare.rb +44 -0
- data/lib/liebre/actor/context/handler.rb +44 -0
- data/lib/liebre/actor/publisher.rb +58 -0
- data/lib/liebre/actor/publisher/core.rb +42 -0
- data/lib/liebre/actor/publisher/reporter.rb +55 -0
- data/lib/liebre/actor/publisher/resources.rb +33 -0
- data/lib/liebre/actor/rpc/client.rb +88 -0
- data/lib/liebre/actor/rpc/client/core.rb +75 -0
- data/lib/liebre/actor/rpc/client/pending.rb +65 -0
- data/lib/liebre/actor/rpc/client/reporter.rb +71 -0
- data/lib/liebre/actor/rpc/client/resources.rb +62 -0
- data/lib/liebre/actor/rpc/client/task.rb +33 -0
- data/lib/liebre/actor/rpc/server.rb +74 -0
- data/lib/liebre/actor/rpc/server/callback.rb +28 -0
- data/lib/liebre/actor/rpc/server/core.rb +75 -0
- data/lib/liebre/actor/rpc/server/reporter.rb +72 -0
- data/lib/liebre/actor/rpc/server/resources.rb +53 -0
- data/lib/liebre/adapter.rb +8 -0
- data/lib/liebre/adapter/bunny.rb +23 -0
- data/lib/liebre/adapter/bunny/chan.rb +38 -0
- data/lib/liebre/adapter/bunny/conn.rb +32 -0
- data/lib/liebre/adapter/bunny/exchange.rb +20 -0
- data/lib/liebre/adapter/bunny/queue.rb +59 -0
- data/lib/liebre/adapter/interface.rb +26 -0
- data/lib/liebre/adapter/interface/chan.rb +29 -0
- data/lib/liebre/adapter/interface/conn.rb +21 -0
- data/lib/liebre/adapter/interface/exchange.rb +13 -0
- data/lib/liebre/adapter/interface/queue.rb +37 -0
- data/lib/liebre/bridge.rb +72 -0
- data/lib/liebre/bridge/channel_builder.rb +36 -0
- data/lib/liebre/config.rb +8 -38
- data/lib/liebre/engine.rb +61 -0
- data/lib/liebre/engine/builder.rb +48 -0
- data/lib/liebre/engine/repository.rb +56 -0
- data/lib/liebre/engine/state.rb +49 -0
- data/lib/liebre/runner.rb +15 -47
- data/lib/liebre/version.rb +1 -1
- data/liebre.gemspec +9 -7
- data/spec/integration/publish_and_consume_spec.rb +71 -0
- data/spec/integration/rpc_communication_spec.rb +81 -0
- data/spec/integration/start_twice_spec.rb +63 -0
- data/spec/liebre/actor/consumer_spec.rb +169 -0
- data/spec/liebre/actor/context/declare_spec.rb +69 -0
- data/spec/liebre/actor/context/handler_spec.rb +65 -0
- data/spec/liebre/actor/publisher_spec.rb +58 -0
- data/spec/liebre/actor/rpc/client_spec.rb +126 -0
- data/spec/liebre/actor/rpc/server_spec.rb +141 -0
- data/spec/liebre/adapter/bunny_spec.rb +66 -0
- data/spec/liebre/bridge_spec.rb +54 -0
- data/spec/liebre/engine/builder_spec.rb +42 -0
- data/spec/liebre/engine_spec.rb +90 -0
- data/spec/liebre/version_spec.rb +10 -0
- data/spec/spec_helper.rb +2 -9
- metadata +97 -58
- data/lib/liebre/common.rb +0 -7
- data/lib/liebre/common/utils.rb +0 -37
- data/lib/liebre/connection_manager.rb +0 -85
- data/lib/liebre/publisher.rb +0 -113
- data/lib/liebre/runner/consumers.rb +0 -46
- data/lib/liebre/runner/starter.rb +0 -44
- data/lib/liebre/runner/starter/consumer.rb +0 -129
- data/lib/liebre/runner/starter/consumer/handler.rb +0 -35
- data/lib/liebre/runner/starter/resources.rb +0 -45
- data/lib/liebre/runner/starter/resources/queue_builder.rb +0 -63
- data/lib/liebre/runner/starter/rpc.rb +0 -59
- data/lib/liebre/tasks.rb +0 -12
- data/spec/config/liebre.yml +0 -48
- data/spec/config/rabbitmq.yml +0 -35
- data/spec/integration_spec.rb +0 -76
- data/spec/liebre/config_spec.rb +0 -63
- data/spec/liebre/connection_manager_spec.rb +0 -44
- data/spec/liebre/publisher_spec.rb +0 -92
- data/spec/liebre/runner/consumers_spec.rb +0 -59
- data/spec/liebre/runner/starter/consumer_spec.rb +0 -145
- data/spec/liebre/runner/starter/resources/queue_builder_spec.rb +0 -69
- data/spec/liebre/runner/starter/resources_spec.rb +0 -38
- data/spec/liebre/runner/starter/rpc_spec.rb +0 -100
- data/spec/liebre/runner/starter_spec.rb +0 -70
- data/spec/liebre/runner_spec.rb +0 -54
@@ -1,145 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Liebre::Runner::Starter::Consumer do
|
4
|
-
|
5
|
-
let(:connection) { double 'connection' }
|
6
|
-
|
7
|
-
let(:class_name) { "MyConsumer" }
|
8
|
-
let(:pool_size) { 4 }
|
9
|
-
|
10
|
-
let :config do
|
11
|
-
{
|
12
|
-
"class_name" => class_name,
|
13
|
-
"pool_size" => pool_size,
|
14
|
-
"rpc" => false,
|
15
|
-
"exchange" => {
|
16
|
-
"name" => "test_exchange",
|
17
|
-
"type" => "direct",
|
18
|
-
"opts" => {
|
19
|
-
"durable" => true
|
20
|
-
}
|
21
|
-
},
|
22
|
-
"queue" => {
|
23
|
-
"name" => "test_queue",
|
24
|
-
"opts" => {
|
25
|
-
"durable" => true
|
26
|
-
}
|
27
|
-
}
|
28
|
-
}
|
29
|
-
end
|
30
|
-
|
31
|
-
let :error_config do
|
32
|
-
{
|
33
|
-
"class_name" => class_name,
|
34
|
-
"pool_size" => pool_size,
|
35
|
-
"rpc" => false,
|
36
|
-
"exchange" => {
|
37
|
-
"name" => "test_exchange-error",
|
38
|
-
"type" => "direct",
|
39
|
-
"opts" => {
|
40
|
-
"durable" => true
|
41
|
-
}
|
42
|
-
},
|
43
|
-
"queue" => {
|
44
|
-
"name" => "test_queue-error",
|
45
|
-
"opts" => {
|
46
|
-
"durable" => true
|
47
|
-
}
|
48
|
-
}
|
49
|
-
}
|
50
|
-
end
|
51
|
-
|
52
|
-
let :parsed_config do
|
53
|
-
{
|
54
|
-
"class_name" => class_name,
|
55
|
-
"pool_size" => pool_size,
|
56
|
-
"rpc" => false,
|
57
|
-
"exchange" => {
|
58
|
-
"name" => "test_exchange",
|
59
|
-
"type" => "direct",
|
60
|
-
"opts" => {
|
61
|
-
"durable" => true
|
62
|
-
}
|
63
|
-
},
|
64
|
-
"queue" => {
|
65
|
-
"name" => "test_queue",
|
66
|
-
"opts" => {
|
67
|
-
"durable" => true,
|
68
|
-
"arguments" => {
|
69
|
-
'x-dead-letter-exchange' => "test_exchange-error"
|
70
|
-
}
|
71
|
-
}
|
72
|
-
}
|
73
|
-
}
|
74
|
-
end
|
75
|
-
|
76
|
-
let(:exchange) { double 'exchange' }
|
77
|
-
let(:queue) { double 'queue', :name => "queue" }
|
78
|
-
let(:error_queue) { double 'error_queue' }
|
79
|
-
let(:channel) { double 'channel' }
|
80
|
-
let(:consumer) { double 'consumer' }
|
81
|
-
let(:payload) { "the_payload" }
|
82
|
-
|
83
|
-
subject { described_class.new(connection, config) }
|
84
|
-
|
85
|
-
let :resources do
|
86
|
-
double 'resources', :exchange => exchange, :queue => queue, :channel => channel
|
87
|
-
end
|
88
|
-
|
89
|
-
let :error_resources do
|
90
|
-
double 'resources', :queue => error_queue
|
91
|
-
end
|
92
|
-
|
93
|
-
let(:class_name) { "MyConsumer" }
|
94
|
-
|
95
|
-
let(:consumer_class) { double 'consumer_class', :name => 'consumer_class' }
|
96
|
-
let(:consumer_instance) { double 'consumer_instance' }
|
97
|
-
|
98
|
-
let :meta do
|
99
|
-
double 'meta'
|
100
|
-
end
|
101
|
-
|
102
|
-
let(:handler) { double 'handler' }
|
103
|
-
|
104
|
-
let(:deliver_info) { double 'deliver_info' }
|
105
|
-
let(:ack) { :ack }
|
106
|
-
|
107
|
-
before do
|
108
|
-
expect(Liebre::Runner::Starter::Resources).to receive(:new).
|
109
|
-
with(connection, error_config).and_return(error_resources)
|
110
|
-
|
111
|
-
expect(Liebre::Runner::Starter::Resources).to receive(:new).
|
112
|
-
with(connection, parsed_config).and_return(resources)
|
113
|
-
|
114
|
-
stub_const(class_name, consumer_class)
|
115
|
-
|
116
|
-
expect(described_class::Handler).to receive(:new).
|
117
|
-
with(channel).and_return handler
|
118
|
-
end
|
119
|
-
|
120
|
-
it 'creates error queue and creates and subscribes to standard queue' do
|
121
|
-
|
122
|
-
expect(queue).to receive :subscribe do |&block|
|
123
|
-
block.call(deliver_info, meta, payload)
|
124
|
-
consumer
|
125
|
-
end
|
126
|
-
|
127
|
-
expect(consumer_class).to receive :new do |given_payload, given_meta|
|
128
|
-
expect(given_payload).to eq payload
|
129
|
-
expect(given_meta ).to eq meta
|
130
|
-
|
131
|
-
consumer_instance
|
132
|
-
end
|
133
|
-
|
134
|
-
expect(consumer_instance).to receive(:call).and_return ack
|
135
|
-
|
136
|
-
expect(handler).to receive(:respond).with ack, deliver_info
|
137
|
-
|
138
|
-
subject.start
|
139
|
-
|
140
|
-
expect(consumer).to receive(:cancel)
|
141
|
-
expect(channel).to receive(:close)
|
142
|
-
subject.stop
|
143
|
-
end
|
144
|
-
|
145
|
-
end
|
@@ -1,69 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Liebre::Runner::Starter::Resources::QueueBuilder do
|
4
|
-
|
5
|
-
let(:channel) { double 'channel' }
|
6
|
-
let(:routing_key) { "foo" }
|
7
|
-
|
8
|
-
let :config do
|
9
|
-
{
|
10
|
-
"queue" => {
|
11
|
-
"name" => "my_queue",
|
12
|
-
"opts" => {"some" => "option"}
|
13
|
-
},
|
14
|
-
"exchange" => {
|
15
|
-
"name" => "my_exchange",
|
16
|
-
"type" => "direct",
|
17
|
-
"opts" => {"an" => "option"}
|
18
|
-
},
|
19
|
-
"bind" => {"routing_key" => routing_key}
|
20
|
-
}
|
21
|
-
end
|
22
|
-
|
23
|
-
let(:exchange) { double 'exchange' }
|
24
|
-
let(:queue) { double 'queue' }
|
25
|
-
|
26
|
-
subject { described_class.new(channel, config) }
|
27
|
-
|
28
|
-
describe '#call' do
|
29
|
-
|
30
|
-
it 'builds and binds the queue properly' do
|
31
|
-
expect(channel).to receive(:exchange).
|
32
|
-
with("my_exchange", :type => "direct", :an => "option").
|
33
|
-
and_return(exchange)
|
34
|
-
|
35
|
-
expect(channel).to receive(:queue).
|
36
|
-
with("my_queue", :some => "option").
|
37
|
-
and_return(queue)
|
38
|
-
|
39
|
-
expect(queue).to receive(:bind).
|
40
|
-
with(exchange, :routing_key => "foo")
|
41
|
-
|
42
|
-
expect(subject.queue).to eq queue
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe "with multiple routing_keys" do
|
47
|
-
let(:routing_key) { %W{a b c} }
|
48
|
-
|
49
|
-
it 'builds and binds the queue properly' do
|
50
|
-
allow(channel).to receive(:exchange).
|
51
|
-
with("my_exchange", :type => "direct", :an => "option").
|
52
|
-
and_return(exchange)
|
53
|
-
|
54
|
-
expect(channel).to receive(:queue).
|
55
|
-
with("my_queue", :some => "option").
|
56
|
-
and_return(queue)
|
57
|
-
|
58
|
-
expect(queue).to receive(:bind).
|
59
|
-
with(exchange, :routing_key => "a")
|
60
|
-
expect(queue).to receive(:bind).
|
61
|
-
with(exchange, :routing_key => "b")
|
62
|
-
expect(queue).to receive(:bind).
|
63
|
-
with(exchange, :routing_key => "c")
|
64
|
-
|
65
|
-
expect(subject.queue).to eq queue
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Liebre::Runner::Starter::Resources do
|
4
|
-
|
5
|
-
let(:connection) { double 'connection' }
|
6
|
-
|
7
|
-
let(:pool_size) { 4 }
|
8
|
-
let(:config) { {"pool_size" => pool_size} }
|
9
|
-
|
10
|
-
subject { described_class.new(connection, config) }
|
11
|
-
|
12
|
-
describe '#exchange and #queue' do
|
13
|
-
let(:channel) { double 'channel' }
|
14
|
-
let(:exchange) { double 'exchange' }
|
15
|
-
|
16
|
-
let(:queue) { double 'queue' }
|
17
|
-
let(:queue_builder) { double 'queue_builder', :queue => queue, :exchange => exchange }
|
18
|
-
|
19
|
-
before do
|
20
|
-
allow(connection).to receive(:create_channel).
|
21
|
-
with(nil, pool_size).and_return(channel)
|
22
|
-
|
23
|
-
allow(channel).to receive(:prefetch).with(10)
|
24
|
-
|
25
|
-
allow(channel).to receive(:default_exchange).
|
26
|
-
and_return(exchange)
|
27
|
-
|
28
|
-
allow(described_class::QueueBuilder).to receive(:new).
|
29
|
-
with(channel, config).and_return(queue_builder)
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'builds exchange and queue properly' do
|
33
|
-
expect(subject.exchange).to eq exchange
|
34
|
-
expect(subject.queue ).to eq queue
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
@@ -1,100 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Liebre::Runner::Starter::RPC do
|
4
|
-
|
5
|
-
let(:connection) { double 'connection' }
|
6
|
-
|
7
|
-
let(:class_name) { "MyRPC" }
|
8
|
-
let(:pool_size) { 4 }
|
9
|
-
|
10
|
-
let :config do
|
11
|
-
{
|
12
|
-
"class_name" => class_name,
|
13
|
-
"pool_size" => pool_size,
|
14
|
-
"rpc" => true,
|
15
|
-
"exchange" => {
|
16
|
-
"name" => "test_exchange",
|
17
|
-
"type" => "direct",
|
18
|
-
"opts" => {
|
19
|
-
"durable" => false
|
20
|
-
}
|
21
|
-
},
|
22
|
-
"queue" => {
|
23
|
-
"name" => "test_queue",
|
24
|
-
"opts" => {
|
25
|
-
"durable" => false
|
26
|
-
}
|
27
|
-
}
|
28
|
-
}
|
29
|
-
end
|
30
|
-
|
31
|
-
let(:exchange) { double 'exchange' }
|
32
|
-
let(:queue) { double 'queue', :name => "queue" }
|
33
|
-
let(:channel) { double 'channel', :default_exchange => exchange }
|
34
|
-
let(:consumer) { double 'consumer' }
|
35
|
-
let(:payload) { "the_payload" }
|
36
|
-
let(:response) { "the_response" }
|
37
|
-
|
38
|
-
subject { described_class.new(connection, config) }
|
39
|
-
|
40
|
-
let :resources do
|
41
|
-
double 'resources', :exchange => exchange, :queue => queue, :channel => channel
|
42
|
-
end
|
43
|
-
|
44
|
-
let(:class_name) { "MyConsumer" }
|
45
|
-
|
46
|
-
let(:rpc_class) { double 'rpc_class', :name => 'rpc_class' }
|
47
|
-
let(:rpc_instance) { double 'rpc_instance' }
|
48
|
-
|
49
|
-
let(:reply_to) { "queue_to_reply_to" }
|
50
|
-
let(:correlation_id) { 123 }
|
51
|
-
let(:headers) { {} }
|
52
|
-
let :meta do
|
53
|
-
double 'meta',
|
54
|
-
:reply_to => reply_to,
|
55
|
-
:correlation_id => correlation_id,
|
56
|
-
:headers => headers
|
57
|
-
end
|
58
|
-
|
59
|
-
let :opts do
|
60
|
-
{:routing_key => reply_to, :correlation_id => correlation_id, :headers => headers}
|
61
|
-
end
|
62
|
-
|
63
|
-
let(:handler) { double 'handler' }
|
64
|
-
|
65
|
-
let(:deliver_info) { double 'deliver_info' }
|
66
|
-
|
67
|
-
before do
|
68
|
-
allow(Liebre::Runner::Starter::Resources).to receive(:new).
|
69
|
-
with(connection, config).and_return(resources)
|
70
|
-
|
71
|
-
stub_const(class_name, rpc_class)
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'creates error queue and creates and subscribes to standard queue' do
|
75
|
-
|
76
|
-
expect(exchange).to receive(:publish).with(response, opts)
|
77
|
-
|
78
|
-
expect(queue).to receive :subscribe do |&block|
|
79
|
-
block.call(deliver_info, meta, payload)
|
80
|
-
consumer
|
81
|
-
end
|
82
|
-
|
83
|
-
expect(rpc_class).to receive :new do |given_payload, given_meta, callback|
|
84
|
-
expect(given_payload).to eq payload
|
85
|
-
expect(given_meta ).to eq meta
|
86
|
-
callback.call(response)
|
87
|
-
|
88
|
-
rpc_instance
|
89
|
-
end
|
90
|
-
|
91
|
-
expect(rpc_instance).to receive(:call)
|
92
|
-
|
93
|
-
subject.start
|
94
|
-
|
95
|
-
expect(consumer).to receive(:cancel)
|
96
|
-
expect(channel).to receive(:close)
|
97
|
-
subject.stop
|
98
|
-
end
|
99
|
-
|
100
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Liebre::Runner::Starter do
|
4
|
-
|
5
|
-
let(:connection_manager) { double 'connection_manager' }
|
6
|
-
let(:connection) { double 'connection' }
|
7
|
-
let(:consumer) { double 'consumer' }
|
8
|
-
|
9
|
-
let(:rpc) { true }
|
10
|
-
|
11
|
-
let :config do
|
12
|
-
{
|
13
|
-
"rpc" => rpc,
|
14
|
-
"connection_name" => "rpc"
|
15
|
-
}
|
16
|
-
end
|
17
|
-
|
18
|
-
subject { described_class.new(connection_manager, config) }
|
19
|
-
|
20
|
-
context "RPC" do
|
21
|
-
|
22
|
-
let(:rpc_instance) { double 'rpc_instance' }
|
23
|
-
|
24
|
-
describe '#start and #stop' do
|
25
|
-
|
26
|
-
it 'calls the rpc_class with a callback' do
|
27
|
-
expect(connection_manager).to receive(:get).with(:rpc).and_return connection
|
28
|
-
expect(described_class::RPC).to receive(:new).with(connection, config).and_return rpc_instance
|
29
|
-
expect(rpc_instance).to receive(:start).and_return consumer
|
30
|
-
|
31
|
-
subject.start
|
32
|
-
|
33
|
-
expect(consumer).to receive(:stop)
|
34
|
-
|
35
|
-
subject.stop
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
context "Standard Consumer" do
|
42
|
-
|
43
|
-
let(:rpc) { false }
|
44
|
-
|
45
|
-
let(:consumer) { double 'consumer' }
|
46
|
-
|
47
|
-
let :config do
|
48
|
-
{
|
49
|
-
"rpc" => rpc
|
50
|
-
}
|
51
|
-
end
|
52
|
-
|
53
|
-
describe '#start and #stop' do
|
54
|
-
|
55
|
-
it 'calls the rpc_class with a callback' do
|
56
|
-
expect(connection_manager).to receive(:get).with(:default).and_return connection
|
57
|
-
expect(described_class::Consumer).to receive(:new).with(connection, config).and_return consumer
|
58
|
-
expect(consumer).to receive(:start).and_return consumer
|
59
|
-
|
60
|
-
subject.start
|
61
|
-
|
62
|
-
expect(consumer).to receive(:stop)
|
63
|
-
|
64
|
-
subject.stop
|
65
|
-
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
end
|
data/spec/liebre/runner_spec.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Liebre::Runner do
|
4
|
-
|
5
|
-
let :connection_path do
|
6
|
-
File.expand_path("../../config/rabbitmq.yml" ,__FILE__)
|
7
|
-
end
|
8
|
-
|
9
|
-
let(:interval) { 1234 }
|
10
|
-
|
11
|
-
subject { described_class.new(interval) }
|
12
|
-
let(:logger) { double 'logger' }
|
13
|
-
|
14
|
-
let(:connection_manager) { double 'connection_manager'}
|
15
|
-
|
16
|
-
let(:consumers) { double 'consumers' }
|
17
|
-
|
18
|
-
before do
|
19
|
-
Liebre::Config.connection_path = connection_path
|
20
|
-
|
21
|
-
allow(subject).to receive(:logger).
|
22
|
-
and_return(logger)
|
23
|
-
|
24
|
-
allow(Liebre::ConnectionManager).to receive(:instance).
|
25
|
-
and_return(connection_manager)
|
26
|
-
|
27
|
-
allow(described_class::Consumers).to receive(:new).
|
28
|
-
with(connection_manager).and_return(consumers)
|
29
|
-
end
|
30
|
-
|
31
|
-
describe '#run' do
|
32
|
-
it 'logs and retries after fail' do
|
33
|
-
expect(connection_manager).to receive(:restart) do
|
34
|
-
raise "some error"
|
35
|
-
end
|
36
|
-
|
37
|
-
expect(logger).to receive(:warn) do |error|
|
38
|
-
expect(error.message).to match /some error/
|
39
|
-
end
|
40
|
-
expect(subject).to receive(:sleep).with(interval)
|
41
|
-
expect(logger).to receive(:warn) do |message|
|
42
|
-
expect(message).to match /Retrying/
|
43
|
-
end
|
44
|
-
|
45
|
-
expect(connection_manager).to receive(:restart)
|
46
|
-
expect(consumers ).to receive(:start_all)
|
47
|
-
|
48
|
-
expect(subject).to receive(:sleep)
|
49
|
-
|
50
|
-
subject.start
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|