deimos-ruby 1.5.0.pre.beta2 → 1.6.0.pre.beta1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2f20063d68540f1d48e8a87b210f42b146156120b0cc183bd9ce9b3aacee848
4
- data.tar.gz: 23a7dac7a19d8defae93a5e675b614541d771b4c46746f12177dbd184ff37d67
3
+ metadata.gz: 23c67fb21e32902a5672c44a081bb6a34a51529a1936962f25855944ef177f4d
4
+ data.tar.gz: 3de138bb2ae80ec08062417160f45103bb681d68edcc7a0cc75eca1c3a56cae9
5
5
  SHA512:
6
- metadata.gz: d3e9e905a67b22e953c9b8066d13adcff0f7c219676791f30e05ba34e007913c7615996278cf1aa52655a3f272d007baefd08f9d2612cbcc7d4453d656872197
7
- data.tar.gz: 7978987a6ba5e56c2d9f5fd46582b17ed4ae85cac8b94fd67a65bac13dd60a0d56491eb91f060b030324e29f94b00158fdd0b87125ba4acd2b0ccfe887a009cf
6
+ metadata.gz: 37f51c89c19891c4490982e101c2ae5c46ce6a389d5a7fd82c45601aa4581c1af2edbe5b261396f6feafd1e91cb0cd73d53689f703d19c553f2bbaaad0c9d694
7
+ data.tar.gz: d1045e3179921f5dc810c701faa513f011fec75bfbbadec6d16de961c768c3c3f796c259018c7dce888a9fdbae55fd53351c8559796ab10378d42125a181b304
data/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## UNRELEASED
9
9
 
10
+ # [1.6.0-beta1] - 2020-02-05
11
+
12
+ - Updated dependency for Phobos to 1.9.0-beta3. This ensures compatibility with
13
+ Phobos 2.0.
14
+ - Fixed RSpec warning when using `test_consume_invalid_message`.
15
+
10
16
  # [1.5.0-beta2] - 2020-01-17
11
17
  - Added schema backends, which should simplify Avro encoding and make it
12
18
  more flexible for unit tests and local development.
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- deimos-ruby (1.5.0.pre.beta2)
4
+ deimos-ruby (1.6.0.pre.beta1)
5
5
  avro_turf (~> 0.11)
6
- phobos (~> 1.8.2.pre.beta2)
6
+ phobos (~> 1.9.0.pre.beta3)
7
7
  ruby-kafka (~> 0.7)
8
8
 
9
9
  GEM
@@ -71,7 +71,7 @@ GEM
71
71
  digest-crc (0.4.1)
72
72
  dogstatsd-ruby (4.5.0)
73
73
  erubi (1.9.0)
74
- excon (0.71.1)
74
+ excon (0.72.0)
75
75
  exponential-backoff (0.0.4)
76
76
  ffi (1.11.3)
77
77
  formatador (0.2.5)
@@ -131,7 +131,7 @@ GEM
131
131
  parser (2.6.5.0)
132
132
  ast (~> 2.4.0)
133
133
  pg (1.1.4)
134
- phobos (1.8.2)
134
+ phobos (1.9.0.pre.beta3)
135
135
  activesupport (>= 3.0.0)
136
136
  concurrent-ruby (>= 1.0.2)
137
137
  concurrent-ruby-ext (>= 1.0.2)
data/deimos-ruby.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
 
21
21
  spec.add_runtime_dependency('avro_turf', '~> 0.11')
22
- spec.add_runtime_dependency('phobos', '~> 1.8.2.pre.beta2')
22
+ spec.add_runtime_dependency('phobos', '~> 1.9.0.pre.beta3')
23
23
  spec.add_runtime_dependency('ruby-kafka', '~> 0.7')
24
24
 
25
25
  spec.add_development_dependency('activerecord', '~> 5.2')
@@ -11,27 +11,24 @@ module Deimos
11
11
  include Phobos::BatchHandler
12
12
 
13
13
  # :nodoc:
14
- def around_consume_batch(payloads, metadata)
15
- _received_batch(payloads, metadata)
14
+ def around_consume_batch(batch, metadata)
15
+ payloads = []
16
16
  benchmark = Benchmark.measure do
17
- _with_error_span(payloads, metadata) { yield }
18
- end
19
- _handle_success(benchmark.real, payloads, metadata)
20
- end
21
-
22
- # :nodoc:
23
- def before_consume_batch(batch, metadata)
24
- _with_error_span(batch, metadata) do
25
17
  if self.class.config[:key_configured]
26
18
  metadata[:keys] = batch.map do |message|
27
19
  decode_key(message.key)
28
20
  end
29
21
  end
30
22
 
31
- batch.map do |message|
32
- self.class.decoder.decode(message.payload) if message.payload.present?
23
+ payloads = batch.map do |message|
24
+ message.payload ? self.class.decoder.decode(message.payload) : nil
25
+ end
26
+ _received_batch(payloads, metadata)
27
+ _with_error_span(payloads, metadata) do
28
+ yield payloads, metadata
33
29
  end
34
30
  end
31
+ _handle_success(benchmark.real, payloads, metadata)
35
32
  end
36
33
 
37
34
  # Consume a batch of incoming messages.
@@ -17,19 +17,15 @@ module Deimos
17
17
  def around_consume(payload, metadata)
18
18
  _received_message(payload, metadata)
19
19
  benchmark = Benchmark.measure do
20
- _with_error_span(payload, metadata) { yield }
20
+ _with_error_span(payload, metadata) do
21
+ metadata[:key] = decode_key(metadata[:key]) if self.class.config[:key_configured]
22
+ decoded_payload = payload ? self.class.decoder.decode(payload) : nil
23
+ yield decoded_payload, metadata
24
+ end
21
25
  end
22
26
  _handle_success(benchmark.real, payload, metadata)
23
27
  end
24
28
 
25
- # :nodoc:
26
- def before_consume(payload, metadata)
27
- _with_error_span(payload, metadata) do
28
- metadata[:key] = decode_key(metadata[:key]) if self.class.config[:key_configured]
29
- self.class.decoder.decode(payload) if payload.present?
30
- end
31
- end
32
-
33
29
  # Consume incoming messages.
34
30
  # @param _payload [String]
35
31
  # @param _metadata [Hash]
@@ -201,6 +201,7 @@ module Deimos
201
201
  'partition_key' => partition_key,
202
202
  'partition' => 1,
203
203
  'offset' => 1,
204
+ 'headers' => {},
204
205
  'value' => payload)
205
206
 
206
207
  unless skip_expectation
@@ -222,7 +223,7 @@ module Deimos
222
223
  expect {
223
224
  handler_class.decoder.validate(payload,
224
225
  schema: handler_class.decoder.schema)
225
- }.to raise_error
226
+ }.to raise_error(Avro::SchemaValidator::ValidationError)
226
227
  end
227
228
 
228
229
  # Test that a given handler will consume a given batch payload correctly,
@@ -262,6 +263,7 @@ module Deimos
262
263
  'partition_key' => partition_key,
263
264
  'partition' => 1,
264
265
  'offset' => 1,
266
+ 'headers' => {},
265
267
  'value' => payload)
266
268
  end
267
269
  batch = double('fetched_batch',
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Deimos
4
- VERSION = '1.5.0-beta2'
4
+ VERSION = '1.6.0-beta1'
5
5
  end
data/spec/spec_helper.rb CHANGED
@@ -151,7 +151,7 @@ RSpec.configure do |config|
151
151
  mocks.verify_partial_doubles = true
152
152
  end
153
153
 
154
- config.before(:each) do |ex|
154
+ config.before(:each) do
155
155
  Deimos.config.reset!
156
156
  Deimos.configure do |deimos_config|
157
157
  deimos_config.phobos_config_file = File.join(File.dirname(__FILE__), 'phobos.yml')
@@ -163,7 +163,6 @@ RSpec.configure do |config|
163
163
  deimos_config.logger.level = Logger::INFO
164
164
  deimos_config.schema.backend = :avro_validation
165
165
  end
166
- stub_producers_and_consumers! unless ex.metadata[:integration]
167
166
  end
168
167
  end
169
168
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deimos-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0.pre.beta2
4
+ version: 1.6.0.pre.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Orner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-17 00:00:00.000000000 Z
11
+ date: 2020-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avro_turf
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.8.2.pre.beta2
33
+ version: 1.9.0.pre.beta3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.8.2.pre.beta2
40
+ version: 1.9.0.pre.beta3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: ruby-kafka
43
43
  requirement: !ruby/object:Gem::Requirement