lapine 0.2.9 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +6 -0
- data/README.md +2 -2
- data/lib/lapine/consumer/dispatcher.rb +3 -3
- data/lib/lapine/consumer/environment.rb +1 -1
- data/lib/lapine/version.rb +1 -1
- data/spec/lib/lapine/consumer/dispatcher_spec.rb +4 -4
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19554974173dd44d98df62ed0ff7a8a34dcaf201
|
4
|
+
data.tar.gz: abc54df05e0e133655eee78b2fc6c50a48db47cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39dd5b1c4bd4145fb0710145afaa00050fdc9b24001f99645a9c82dd9c205ae01e32ad1736100df87b1ab7809c25edf7f55192b22a9858dde1e0f9ccb58dd3b3
|
7
|
+
data.tar.gz: 35470b955af0f1ade5a271b8983d51a91988e62a21466b03726d55da67fbbd11eaad0f0bc87a7fd41524915972df3be0352d2a463457572962ded1313982c1d8
|
data/Changelog.md
ADDED
data/README.md
CHANGED
@@ -75,8 +75,8 @@ are arbitrary.
|
|
75
75
|
|
76
76
|
## Consumer Usage
|
77
77
|
|
78
|
-
Please see the Lapine wiki for documentation
|
79
|
-
consumers.
|
78
|
+
Please see the [Lapine wiki](https://github.com/wanelo/lapine/wiki) for documentation
|
79
|
+
on defining and configuring consumers.
|
80
80
|
|
81
81
|
|
82
82
|
## But... WHY
|
@@ -6,7 +6,7 @@ module Lapine
|
|
6
6
|
class Dispatcher
|
7
7
|
class DefaultErrorHandler
|
8
8
|
|
9
|
-
def call(e, data)
|
9
|
+
def call(e, data, _metadata)
|
10
10
|
$stderr.puts "Lapine::Dispatcher unable to dispatch, #{e.message}, data: #{data}"
|
11
11
|
end
|
12
12
|
end
|
@@ -34,9 +34,9 @@ module Lapine
|
|
34
34
|
json = Oj.load(raw_payload)
|
35
35
|
with_timed_logging(json) { do_dispatch(json) }
|
36
36
|
rescue Oj::Error => e
|
37
|
-
self.class.error_handler.call(e, raw_payload)
|
37
|
+
self.class.error_handler.call(e, raw_payload, metadata)
|
38
38
|
rescue StandardError => e
|
39
|
-
self.class.error_handler.call(e, json)
|
39
|
+
self.class.error_handler.call(e, json, metadata)
|
40
40
|
end
|
41
41
|
Lapine::DTrace.fire!(:dispatch_return, delegate_class.name, raw_payload)
|
42
42
|
end
|
data/lib/lapine/version.rb
CHANGED
@@ -44,8 +44,8 @@ RSpec.describe Lapine::Consumer::Dispatcher do
|
|
44
44
|
|
45
45
|
context 'custom error handler' do
|
46
46
|
before do
|
47
|
-
Lapine::Consumer::Dispatcher.error_handler = ->(error, data) {
|
48
|
-
caught_errors << [error, data]
|
47
|
+
Lapine::Consumer::Dispatcher.error_handler = ->(error, data, metadata) {
|
48
|
+
caught_errors << [error, data, metadata]
|
49
49
|
}
|
50
50
|
end
|
51
51
|
context 'with invalid json' do
|
@@ -53,7 +53,7 @@ RSpec.describe Lapine::Consumer::Dispatcher do
|
|
53
53
|
|
54
54
|
it 'notifies the error handler with the raw payload' do
|
55
55
|
dispatcher.dispatch
|
56
|
-
expect(caught_errors).to include([an_instance_of(Oj::ParseError), json])
|
56
|
+
expect(caught_errors).to include([an_instance_of(Oj::ParseError), json, metadata])
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -62,7 +62,7 @@ RSpec.describe Lapine::Consumer::Dispatcher do
|
|
62
62
|
|
63
63
|
it 'notifies error handler with the parsed json' do
|
64
64
|
dispatcher.dispatch
|
65
|
-
expect(caught_errors).to include([an_instance_of(ArgumentError), hash])
|
65
|
+
expect(caught_errors).to include([an_instance_of(ArgumentError), hash, metadata])
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lapine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Saxby
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-02-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: amqp
|
@@ -161,6 +161,7 @@ extra_rdoc_files: []
|
|
161
161
|
files:
|
162
162
|
- ".gitignore"
|
163
163
|
- ".rspec"
|
164
|
+
- Changelog.md
|
164
165
|
- Gemfile
|
165
166
|
- Guardfile
|
166
167
|
- LICENSE.txt
|