deimos-ruby 1.8.1.pre.beta4 → 1.8.1.pre.beta5
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/deimos/active_record_consume/batch_consumption.rb +7 -2
- data/lib/deimos/active_record_consume/message_consumption.rb +8 -1
- data/lib/deimos/version.rb +1 -1
- data/spec/kafka_listener_spec.rb +1 -0
- 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: 516d09f0dc29c3388d1885c67d7faf3c2f240eede7278ad1ac76dfa46727e4e7
|
|
4
|
+
data.tar.gz: c9fcf141d5dfca3de041d82079f773c53b6a2f663fe7a8b3aa5fbee28964fb19
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f4b5feee05510a8e6c9d85c9af85aff48f01c43419b5e5600a853d60a62d4b06f8430bb91b11047f6fd2579f23a89e8b9cbafe41a40ed84f7448a54b47115587
|
|
7
|
+
data.tar.gz: e4c1a0b181f4e5289f995056338b78cab4a8da3cb50863e70ba9f78e8526e470a52a035eaa3a34a0261b1ad14dbff41d2e25a3ffff5e75218408e31aa94a9ed0
|
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.8.1-beta5 - 2020-08-13
|
|
11
|
+
|
|
12
|
+
### Fixes :wrench:
|
|
13
|
+
- Fix regression bug which introduces backwards incompatibility
|
|
14
|
+
with ActiveRecordProducer's `record_attributes` method.
|
|
15
|
+
|
|
10
16
|
## 1.8.1-beta4 - 2020-08-12
|
|
11
17
|
|
|
12
18
|
### Fixes :wrench:
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -599,7 +599,7 @@ class MyConsumer < Deimos::ActiveRecordConsumer
|
|
|
599
599
|
|
|
600
600
|
# Optional override to change the attributes of the record before they
|
|
601
601
|
# are saved.
|
|
602
|
-
def record_attributes(payload)
|
|
602
|
+
def record_attributes(payload, key)
|
|
603
603
|
super.merge(:some_field => 'some_value')
|
|
604
604
|
end
|
|
605
605
|
|
|
@@ -680,7 +680,7 @@ class MyConsumer < Deimos::ActiveRecordConsumer
|
|
|
680
680
|
|
|
681
681
|
# Optional override to change the attributes of the record before they
|
|
682
682
|
# are saved.
|
|
683
|
-
def record_attributes(payload)
|
|
683
|
+
def record_attributes(payload, key)
|
|
684
684
|
super.merge(:some_field => 'some_value')
|
|
685
685
|
end
|
|
686
686
|
end
|
|
@@ -88,8 +88,13 @@ module Deimos
|
|
|
88
88
|
|
|
89
89
|
# Create payloads with payload + key attributes
|
|
90
90
|
upserts = messages.map do |m|
|
|
91
|
-
record_attributes
|
|
92
|
-
|
|
91
|
+
attrs = if self.method(:record_attributes).parameters.size == 2
|
|
92
|
+
record_attributes(m.payload, m.key)
|
|
93
|
+
else
|
|
94
|
+
record_attributes(m.payload)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
attrs&.merge(record_key(m.key))
|
|
93
98
|
end
|
|
94
99
|
|
|
95
100
|
# If overridden record_attributes indicated no record, skip
|
|
@@ -37,7 +37,14 @@ module Deimos
|
|
|
37
37
|
record = klass.new
|
|
38
38
|
assign_key(record, payload, key)
|
|
39
39
|
end
|
|
40
|
-
|
|
40
|
+
|
|
41
|
+
# for backwards compatibility
|
|
42
|
+
# TODO next major release we should deprecate this
|
|
43
|
+
attrs = if self.method(:record_attributes).parameters.size == 2
|
|
44
|
+
record_attributes(payload.with_indifferent_access, key)
|
|
45
|
+
else
|
|
46
|
+
record_attributes(payload.with_indifferent_access)
|
|
47
|
+
end
|
|
41
48
|
# don't use attributes= - bypass Rails < 5 attr_protected
|
|
42
49
|
attrs.each do |k, v|
|
|
43
50
|
record.send("#{k}=", v)
|
data/lib/deimos/version.rb
CHANGED
data/spec/kafka_listener_spec.rb
CHANGED
|
@@ -30,6 +30,7 @@ describe Deimos::KafkaListener do
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
it 'should listen to publishing errors and republish as Deimos events' do
|
|
33
|
+
allow(Deimos::Producer).to receive(:descendants).and_return([MyProducer])
|
|
33
34
|
Deimos.subscribe('produce_error') do |event|
|
|
34
35
|
expect(event.payload).to include(
|
|
35
36
|
producer: MyProducer,
|
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.8.1.pre.
|
|
4
|
+
version: 1.8.1.pre.beta5
|
|
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-08-
|
|
11
|
+
date: 2020-08-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: avro_turf
|