rabbit_feed 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -2
- data/README.md +2 -2
- data/example/non_rails_app/Gemfile.lock +1 -1
- data/example/rails_app/Gemfile.lock +1 -1
- data/lib/rabbit_feed.rb +7 -11
- data/lib/rabbit_feed/version.rb +1 -1
- data/spec/lib/rabbit_feed/consumer_connection_spec.rb +14 -41
- data/spec/lib/rabbit_feed/producer_connection_spec.rb +7 -33
- 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: 0dd9a18fb2e4684fc9680be20a40caa49605c22e
|
4
|
+
data.tar.gz: 61f4a4c44a773c7cf649dc6a80216cb261d8ae68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66657f7a397849d419d01a62a52c8f43e011025affb5772205f3fbc8c719f76ff1ad2f7407ea3a50675e62bf6320bb43ac8eb70c220a45a9f14caf1aade04bfc
|
7
|
+
data.tar.gz: 51998a861c4fba7d1f25fa0b0bd53ddd8c3343fa3c0c64959ef03bcdc4fabd7414363bc83d4cd2ed3baf30528504bedd2635ed01c40b264753fc867e8cb684e9
|
data/.rubocop.yml
CHANGED
@@ -28,7 +28,6 @@ Metrics/ClassLength:
|
|
28
28
|
Metrics/CyclomaticComplexity:
|
29
29
|
Exclude:
|
30
30
|
- 'lib/rabbit_feed/configuration.rb'
|
31
|
-
- 'lib/rabbit_feed.rb'
|
32
31
|
- 'lib/rabbit_feed/testing_support/rspec_matchers/publish_event.rb'
|
33
32
|
|
34
33
|
Metrics/LineLength:
|
@@ -45,7 +44,6 @@ Metrics/ModuleLength:
|
|
45
44
|
Metrics/PerceivedComplexity:
|
46
45
|
Exclude:
|
47
46
|
- 'lib/rabbit_feed/configuration.rb'
|
48
|
-
- 'lib/rabbit_feed.rb'
|
49
47
|
- 'lib/rabbit_feed/testing_support/rspec_matchers/publish_event.rb'
|
50
48
|
|
51
49
|
Style/Documentation:
|
data/README.md
CHANGED
@@ -119,7 +119,7 @@ The event will be published to the configured exchange on RabbitMQ (`amq.topic`
|
|
119
119
|
|
120
120
|
### Returned Events
|
121
121
|
|
122
|
-
In the case that there are no consumers configured to subscribe to an event, the event will be returned to the producer. The returned event will be logged, and if your project uses [Airbrake](https://airbrake.io), an error will be reported there.
|
122
|
+
In the case that there are no consumers configured to subscribe to an event, the event will be returned to the producer. The returned event will be logged, and if your project uses [Airbrake (v5.0+) or Airbrake-Ruby](https://airbrake.io), an error will be reported there.
|
123
123
|
|
124
124
|
### Testing the Producer
|
125
125
|
|
@@ -238,7 +238,7 @@ More information about the consumer command line options can be found [here](htt
|
|
238
238
|
|
239
239
|
### Event Processing Errors
|
240
240
|
|
241
|
-
In the case that your consumer raises an error whilst processing an event, the error will be logged. If your project uses [Airbrake](https://airbrake.io), the error will also be reported there. The event that was being processed will remain on the RabbitMQ queue, and will be redelivered to the consumer until it is processed without error.
|
241
|
+
In the case that your consumer raises an error whilst processing an event, the error will be logged. If your project uses [Airbrake (v5.0+) or Airbrake-Ruby](https://airbrake.io), the error will also be reported there. The event that was being processed will remain on the RabbitMQ queue, and will be redelivered to the consumer until it is processed without error.
|
242
242
|
|
243
243
|
### Testing the Consumer
|
244
244
|
|
data/lib/rabbit_feed.rb
CHANGED
@@ -34,17 +34,13 @@ module RabbitFeed
|
|
34
34
|
|
35
35
|
def exception_notify(exception)
|
36
36
|
return unless defined?(Airbrake)
|
37
|
-
if
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
else
|
45
|
-
# Airbrake notify default to sending notification asynchronously
|
46
|
-
Airbrake.notify exception
|
47
|
-
end
|
37
|
+
if RabbitFeed.configuration.consumer_exit_after_fail
|
38
|
+
# Will need to send the notification right away, otherwise the `exit` would kill the
|
39
|
+
# Airbrake before the notification is sent out
|
40
|
+
Airbrake.notify_sync exception
|
41
|
+
else
|
42
|
+
# Airbrake notify default to sending notification asynchronously
|
43
|
+
Airbrake.notify exception
|
48
44
|
end
|
49
45
|
end
|
50
46
|
|
data/lib/rabbit_feed/version.rb
CHANGED
@@ -116,52 +116,25 @@ module RabbitFeed
|
|
116
116
|
before { allow(RabbitFeed.configuration).to receive(:consumer_exit_after_fail).and_return(false) }
|
117
117
|
|
118
118
|
context 'when Airbrake is defined' do
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
119
|
+
around do |example|
|
120
|
+
module ::Airbrake; end
|
121
|
+
example.run
|
122
|
+
Object.send(:remove_const, 'Airbrake'.to_sym)
|
123
123
|
end
|
124
124
|
|
125
|
-
context '
|
126
|
-
before
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
allow(Airbrake).to receive(:configuration).and_return(airbrake_configuration)
|
131
|
-
end
|
132
|
-
|
133
|
-
context 'and the Airbrake configuration is public' do
|
134
|
-
let(:airbrake_configuration) { double(:airbrake_configuration, public?: true) }
|
135
|
-
|
136
|
-
it 'notifies airbrake' do
|
137
|
-
expect(Airbrake).to receive(:notify_or_ignore).with(an_instance_of(RuntimeError))
|
138
|
-
|
139
|
-
expect { subject.consume { raise 'Consuming time' } }.not_to raise_error
|
140
|
-
end
|
125
|
+
context 'and consumer_exit_after_fail is true' do
|
126
|
+
before { allow(RabbitFeed.configuration).to receive(:consumer_exit_after_fail).and_return(true) }
|
127
|
+
it 'notifies airbrake synchronously' do
|
128
|
+
expect(Airbrake).to receive(:notify_sync).with(an_instance_of(RuntimeError))
|
129
|
+
expect { subject.consume { raise 'Consuming time' } }.not_to raise_error
|
141
130
|
end
|
142
131
|
end
|
143
132
|
|
144
|
-
context '
|
145
|
-
before
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
end
|
150
|
-
|
151
|
-
context 'and consumer_exit_after_fail is true' do
|
152
|
-
before { allow(RabbitFeed.configuration).to receive(:consumer_exit_after_fail).and_return(true) }
|
153
|
-
it 'notifies airbrake synchronously' do
|
154
|
-
expect(Airbrake).to receive(:notify_sync).with(an_instance_of(RuntimeError))
|
155
|
-
expect { subject.consume { raise 'Consuming time' } }.not_to raise_error
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
context 'and consumer_exit_after_fail is not true' do
|
160
|
-
before { allow(RabbitFeed.configuration).to receive(:consumer_exit_after_fail).and_return(false) }
|
161
|
-
it 'notifies airbrake' do
|
162
|
-
expect(Airbrake).to receive(:notify).with(an_instance_of(RuntimeError))
|
163
|
-
expect { subject.consume { raise 'Consuming time' } }.not_to raise_error
|
164
|
-
end
|
133
|
+
context 'and consumer_exit_after_fail is not true' do
|
134
|
+
before { allow(RabbitFeed.configuration).to receive(:consumer_exit_after_fail).and_return(false) }
|
135
|
+
it 'notifies airbrake' do
|
136
|
+
expect(Airbrake).to receive(:notify).with(an_instance_of(RuntimeError))
|
137
|
+
expect { subject.consume { raise 'Consuming time' } }.not_to raise_error
|
165
138
|
end
|
166
139
|
end
|
167
140
|
end
|
@@ -19,42 +19,16 @@ module RabbitFeed
|
|
19
19
|
end
|
20
20
|
|
21
21
|
describe '#handle_returned_message' do
|
22
|
-
after do
|
23
|
-
begin
|
24
|
-
Object.send(:remove_const, 'Airbrake'.to_sym)
|
25
|
-
rescue NameError; end
|
26
|
-
end
|
27
|
-
|
28
22
|
context 'when Airbrake is defined' do
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
34
|
-
allow(Airbrake).to receive(:configuration).and_return(airbrake_configuration)
|
35
|
-
end
|
36
|
-
|
37
|
-
context 'and the Airbrake configuration is public' do
|
38
|
-
let(:airbrake_configuration) { double(:airbrake_configuration, public?: true) }
|
39
|
-
|
40
|
-
it 'notifies Airbrake of the return' do
|
41
|
-
expect(Airbrake).to receive(:notify_or_ignore).with(an_instance_of(ReturnedMessageError))
|
42
|
-
described_class.handle_returned_message 1, 2
|
43
|
-
end
|
44
|
-
end
|
23
|
+
around do |example|
|
24
|
+
module ::Airbrake; end
|
25
|
+
example.run
|
26
|
+
Object.send(:remove_const, 'Airbrake'.to_sym)
|
45
27
|
end
|
46
28
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
AIRBRAKE_VERSION = '5.0.0'.freeze
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'notifies Airbrake of the return' do
|
55
|
-
expect(Airbrake).to receive(:notify).with(an_instance_of(ReturnedMessageError))
|
56
|
-
described_class.handle_returned_message 1, 2
|
57
|
-
end
|
29
|
+
it 'notifies Airbrake of the return' do
|
30
|
+
expect(Airbrake).to receive(:notify).with(an_instance_of(ReturnedMessageError))
|
31
|
+
described_class.handle_returned_message 1, 2
|
58
32
|
end
|
59
33
|
end
|
60
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rabbit_feed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simply Business
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|