lapine 0.2.9 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 00c5975716fde4c26b9c4f07e975ceafb7c5fc52
4
- data.tar.gz: 4eea9f3c8a607fa6b40d7461b266a2abd354012b
3
+ metadata.gz: 19554974173dd44d98df62ed0ff7a8a34dcaf201
4
+ data.tar.gz: abc54df05e0e133655eee78b2fc6c50a48db47cd
5
5
  SHA512:
6
- metadata.gz: db1368b8ae7112b58968ad0992e64242f20288cd4a9140fd531921cff03d13537625aeaf87a54d83b4fc20b10dd7ea3a17f1270a5005e36e94676318cac0bb86
7
- data.tar.gz: f20f048d5e86cea988b11ae1d2f080d2da529266d50a55b95831118ee69818da26bb0806958d2915d9791284e58b341e8f37e9ab18efc191a59efeda0d0da7d1
6
+ metadata.gz: 39dd5b1c4bd4145fb0710145afaa00050fdc9b24001f99645a9c82dd9c205ae01e32ad1736100df87b1ab7809c25edf7f55192b22a9858dde1e0f9ccb58dd3b3
7
+ data.tar.gz: 35470b955af0f1ade5a271b8983d51a91988e62a21466b03726d55da67fbbd11eaad0f0bc87a7fd41524915972df3be0352d2a463457572962ded1313982c1d8
data/Changelog.md ADDED
@@ -0,0 +1,6 @@
1
+ Change Log
2
+ ==========
3
+
4
+ ## 1.0.0
5
+
6
+ * Breaking Change - error handler includes metadata in method signature
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 on defining and configuring
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
@@ -15,7 +15,7 @@ module Lapine
15
15
 
16
16
  def set_environment
17
17
  ENV['RAILS_ENV'] ||= 'development'
18
- ENV['RACK_ENV'] = ENV['RAILS_ENV']
18
+ ENV['RACK_ENV'] ||= ENV['RAILS_ENV']
19
19
  end
20
20
 
21
21
  def load_rails
@@ -1,3 +1,3 @@
1
1
  module Lapine
2
- VERSION = '0.2.9'
2
+ VERSION = '1.0.0'
3
3
  end
@@ -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.2.9
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-01-23 00:00:00.000000000 Z
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