deimos-ruby 1.6.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -2
- data/Gemfile.lock +2 -2
- data/lib/deimos/consumer.rb +3 -2
- data/lib/deimos/version.rb +1 -1
- data/spec/consumer_spec.rb +17 -0
- data/spec/producer_spec.rb +3 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0226368aa5a493ec167e0cd4b0d03eeb8ac9e3efe8c2518fbe869275f6b7b10b'
|
4
|
+
data.tar.gz: 94afab34fb599d3cc0a5336a0af1ab8458621c8655c22de6882d1b87a645d8bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee0516157c9fedd3e0ad9ff5dab95afbd9d3eee0975c899ede0f8104c1c9b5e992117221a8e42772f397abc3b8e70c755a90423a8d3daf93fd949751b3095f38
|
7
|
+
data.tar.gz: e42ad9fca0314bfa6cf5f764f7369a22a28d60c4d395b219df2d0c1ad1bb0c2d45a37d9e5eeb76984dbd7d122f211f4f8bbf8a5d0198108346bc8c16df795266
|
data/CHANGELOG.md
CHANGED
@@ -7,55 +7,74 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## UNRELEASED
|
9
9
|
|
10
|
+
## [1.6.1] - 2020-04-20
|
11
|
+
### Fixes :wrench:
|
12
|
+
- Re-consuming a message after crashing would try to re-decode message keys.
|
13
|
+
|
10
14
|
# [1.6.0] - 2020-03-05
|
15
|
+
### Roadmap :car:
|
11
16
|
- Removed `was_message_sent?` method from `TestHelpers`.
|
12
|
-
- Bumped version to 1.6.0.
|
13
17
|
|
14
18
|
# [1.6.0-beta1] - 2020-02-05
|
19
|
+
### Roadmap :car:
|
15
20
|
- Updated dependency for Phobos to 1.9.0-beta3. This ensures compatibility with
|
16
21
|
Phobos 2.0.
|
22
|
+
### Fixes :wrench:
|
17
23
|
- Fixed RSpec warning when using `test_consume_invalid_message`.
|
18
24
|
|
19
25
|
# [1.5.0-beta2] - 2020-01-17
|
26
|
+
### Roadmap :car:
|
20
27
|
- Added schema backends, which should simplify Avro encoding and make it
|
21
28
|
more flexible for unit tests and local development.
|
29
|
+
### Features :star:
|
22
30
|
- Add `:test` producer backend which replaces the existing TestHelpers
|
23
31
|
functionality of writing messages to an in-memory hash.
|
24
32
|
|
25
33
|
# [1.4.0-beta7] - 2019-12-16
|
34
|
+
### Fixes :wrench:
|
26
35
|
- Clone loggers when assigning to multiple levels.
|
27
36
|
|
28
37
|
# [1.4.0-beta6] - 2019-12-16
|
38
|
+
### Features :star:
|
29
39
|
- Added default for max_bytes_per_partition.
|
30
40
|
|
31
41
|
# [1.4.0-beta4] - 2019-11-26
|
42
|
+
### Features :star:
|
32
43
|
- Added `define_settings` to define settings without invoking callbacks.
|
33
44
|
|
34
45
|
# [1.4.0-beta2] - 2019-11-22
|
35
|
-
|
46
|
+
### Fixes :wrench:
|
47
|
+
- Settings with default_proc were being called immediately
|
36
48
|
instead of being lazy-evaluated.
|
37
49
|
|
38
50
|
# [1.4.0-beta1] - 2019-11-22
|
51
|
+
### Roadmap :car:
|
39
52
|
- Complete revamp of configuration method.
|
40
53
|
|
41
54
|
# [1.3.0-beta5] - 2020-01-14
|
55
|
+
### Features :star:
|
42
56
|
- Added `db_producer.insert` and `db_producer.process` metrics.
|
43
57
|
|
44
58
|
# [1.3.0-beta4] - 2019-12-02
|
59
|
+
### Fixes :wrench:
|
45
60
|
- Fixed bug where by running `rake deimos:start` without
|
46
61
|
specifying a producer backend would crash.
|
47
62
|
|
48
63
|
# [1.3.0-beta3] - 2019-11-26
|
64
|
+
### Fixes :wrench:
|
49
65
|
- Fixed bug in TestHelpers where key_decoder was not stubbed out.
|
50
66
|
|
51
67
|
# [1.3.0-beta2] - 2019-11-22
|
68
|
+
### Fixes :wrench:
|
52
69
|
- Fixed bug where consumers would require a key config in all cases
|
53
70
|
even though it's optional if they don't use keys.
|
54
71
|
|
55
72
|
# [1.3.0-beta1] - 2019-11-21
|
73
|
+
### Features :star:
|
56
74
|
- Added `fetch_record` and `assign_key` methods to ActiveRecordConsumer.
|
57
75
|
|
58
76
|
# [1.2.0-beta1] - 2019-09-12
|
77
|
+
### Features :star:
|
59
78
|
- Added `fatal_error` to both global config and consumer classes.
|
60
79
|
- Changed `pending_db_messages_max_wait` metric to send per topic.
|
61
80
|
- Added config to compact messages in the DB producer.
|
@@ -63,13 +82,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
63
82
|
- Added config to provide a separate logger to the DB producer.
|
64
83
|
|
65
84
|
# [1.1.0-beta2] - 2019-09-11
|
85
|
+
### Fixes :wrench:
|
66
86
|
- Fixed bug where ActiveRecordConsumer was not using `unscoped` to update
|
67
87
|
via primary key and causing duplicate record errors.
|
68
88
|
|
69
89
|
# [1.1.0-beta1] - 2019-09-10
|
90
|
+
### Features :star:
|
70
91
|
- Added BatchConsumer.
|
71
92
|
|
72
93
|
## [1.0.0] - 2019-09-03
|
94
|
+
### Roadmap :car:
|
73
95
|
- Official release of Deimos 1.0!
|
74
96
|
|
75
97
|
## [1.0.0-beta26] - 2019-08-29
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
deimos-ruby (1.6.
|
4
|
+
deimos-ruby (1.6.1)
|
5
5
|
avro_turf (~> 0.11)
|
6
6
|
phobos (~> 1.9)
|
7
7
|
ruby-kafka (~> 0.7)
|
@@ -71,7 +71,7 @@ GEM
|
|
71
71
|
digest-crc (0.5.1)
|
72
72
|
dogstatsd-ruby (4.5.0)
|
73
73
|
erubi (1.9.0)
|
74
|
-
excon (0.
|
74
|
+
excon (0.73.0)
|
75
75
|
exponential-backoff (0.0.4)
|
76
76
|
ffi (1.11.3)
|
77
77
|
formatador (0.2.5)
|
data/lib/deimos/consumer.rb
CHANGED
@@ -18,9 +18,10 @@ module Deimos
|
|
18
18
|
_received_message(payload, metadata)
|
19
19
|
benchmark = Benchmark.measure do
|
20
20
|
_with_error_span(payload, metadata) do
|
21
|
-
|
21
|
+
new_metadata = metadata.dup
|
22
|
+
new_metadata[:key] = decode_key(metadata[:key]) if self.class.config[:key_configured]
|
22
23
|
decoded_payload = payload ? self.class.decoder.decode(payload) : nil
|
23
|
-
yield decoded_payload,
|
24
|
+
yield decoded_payload, new_metadata
|
24
25
|
end
|
25
26
|
end
|
26
27
|
_handle_success(benchmark.real, payload, metadata)
|
data/lib/deimos/version.rb
CHANGED
data/spec/consumer_spec.rb
CHANGED
@@ -32,6 +32,23 @@ module ConsumerTest
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
+
it 'should consume a message idempotently' do
|
36
|
+
# testing for a crash and re-consuming the same message/metadata
|
37
|
+
key = { 'test_id' => 'foo' }
|
38
|
+
test_metadata = { key: key }
|
39
|
+
allow_any_instance_of(MyConsumer).to(receive(:decode_key)) do |_instance, k|
|
40
|
+
k['test_id']
|
41
|
+
end
|
42
|
+
MyConsumer.new.around_consume({ 'test_id' => 'foo',
|
43
|
+
'some_int' => 123 }, test_metadata) do |_payload, metadata|
|
44
|
+
expect(metadata[:key]).to eq('foo')
|
45
|
+
end
|
46
|
+
MyConsumer.new.around_consume({ 'test_id' => 'foo',
|
47
|
+
'some_int' => 123 }, test_metadata) do |_payload, metadata|
|
48
|
+
expect(metadata[:key]).to eq('foo')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
35
52
|
it 'should consume a message on a topic' do
|
36
53
|
test_consume_message('my_consume_topic',
|
37
54
|
'test_id' => 'foo',
|
data/spec/producer_spec.rb
CHANGED
@@ -89,15 +89,9 @@ module ProducerTest
|
|
89
89
|
[{ 'test_id' => 'foo', 'some_int' => 123 },
|
90
90
|
{ 'test_id' => 'bar', 'some_int' => 124 }]
|
91
91
|
)
|
92
|
-
expect(
|
93
|
-
|
94
|
-
).
|
95
|
-
expect(
|
96
|
-
was_message_sent?({ 'test_id' => 'foo', 'some_int' => 123 }, 'your-topic')
|
97
|
-
).to be(false)
|
98
|
-
expect(
|
99
|
-
was_message_sent?({ 'test_id' => 'foo2', 'some_int' => 123 }, 'my-topic')
|
100
|
-
).to be(false)
|
92
|
+
expect('my-topic').to have_sent('test_id' => 'foo', 'some_int' => 123)
|
93
|
+
expect('your-topic').not_to have_sent('test_id' => 'foo', 'some_int' => 123)
|
94
|
+
expect('my-topic').not_to have_sent('test_id' => 'foo2', 'some_int' => 123)
|
101
95
|
end
|
102
96
|
|
103
97
|
it 'should add a message ID' do
|
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.6.
|
4
|
+
version: 1.6.1
|
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-
|
11
|
+
date: 2020-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avro_turf
|