dionysus-rb 1.0.0 → 1.1.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
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d190bbc3fd4b2ca0aa7c7d1be7c0ddaa6a3b6bdcbd6556b90e4752c2e875bfc6
|
|
4
|
+
data.tar.gz: 33379f5ccc97bceee7caad1d9b3383e84c3073e48b15bda1d0f592e765c39352
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cafb4cb76ad00f5dbbc45f9c3a578284ef554aaf680310286961d1f8251620bc67c10e190f301ac06fca1c8e55be9fab2e75977cc85ecf80f21503504558da20
|
|
7
|
+
data.tar.gz: 78e8c07d652f3dcc46cb3a527834cb72b2290b119266e4362cde3ddbf1d5679c147cb03cce34acb6682451c6453fb58532faab8a7bf5be43a6db6be791e7e1e2
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [1.1.0]
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Keep the last published message when removing duplicates from a consumer batch. `RemoveDuplicatesStrategy` kept the message with the highest payload `updated_at` per event and id, but payloads are serialized at publish time, so freshness follows publish order rather than `updated_at`: a payload carrying values computed on read from associated records changes without the record's own `updated_at` changing, and can then arrive with an older `updated_at` than a staler message. Those messages were silently discarded, losing the change in every consumer with no error and no trace. The message with the highest Kafka offset is kept instead - a Karafka batch comes from a single topic-partition, so offsets strictly increase in publish order.
|
|
8
|
+
|
|
3
9
|
## [1.0.0]
|
|
4
10
|
|
|
5
11
|
Brings `dionysus-rb` back in line with the private gem it was extracted from, which had moved on
|
data/Gemfile.lock
CHANGED
|
@@ -10,18 +10,16 @@ class Dionysus::Consumer::ParamsBatchTransformations::RemoveDuplicatesStrategy
|
|
|
10
10
|
private
|
|
11
11
|
|
|
12
12
|
# the idea is following:
|
|
13
|
-
# 1. group messages by event and id - for a given model we can expect unique messages for _created and _deleted
|
|
13
|
+
# 1. group messages by event and id - for a given model we can expect unique messages for _created and _deleted events
|
|
14
14
|
# but we can have multiple _updated events, so this is where we are interested in removing duplicates
|
|
15
|
-
# 2.
|
|
16
|
-
#
|
|
15
|
+
# 2. from each group keep the message published last (highest offset) - payloads are serialized at
|
|
16
|
+
# publish time, so that is the freshest state; "updated_at" does not track it
|
|
17
17
|
# 3. flatten the array of arrays as all groups will have a single item
|
|
18
|
-
# It is safer to apply sorting just for the _updated events to a given model as otherwise we could change the order of
|
|
19
|
-
# the messages for a different type which might be not desirable
|
|
20
18
|
def transform_messages_array(params_batch)
|
|
21
19
|
params_batch
|
|
22
20
|
.to_a
|
|
23
21
|
.group_by { |batch| grouping_key_by_event_and_id(batch) }
|
|
24
|
-
.map { |_, group| group.max_by
|
|
22
|
+
.map { |_, group| group.max_by(&:offset) }
|
|
25
23
|
.flatten
|
|
26
24
|
end
|
|
27
25
|
|
|
@@ -32,14 +30,6 @@ class Dionysus::Consumer::ParamsBatchTransformations::RemoveDuplicatesStrategy
|
|
|
32
30
|
].join
|
|
33
31
|
end
|
|
34
32
|
|
|
35
|
-
def updated_at_from_batch(batch)
|
|
36
|
-
timestamp = batch.payload.fetch("message", []).first.to_h.fetch("data", []).first.to_h.fetch("updated_at", nil)
|
|
37
|
-
|
|
38
|
-
return timestamp.to_datetime if timestamp.respond_to?(:to_datetime)
|
|
39
|
-
|
|
40
|
-
Time.current
|
|
41
|
-
end
|
|
42
|
-
|
|
43
33
|
def duplicates_removal_not_applicable?(params_batch)
|
|
44
34
|
any_message_containing_more_than_one_event?(params_batch) || any_event_containing_more_than_one_item(params_batch)
|
|
45
35
|
end
|
data/lib/dionysus/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dionysus-rb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Karol Galanciak
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: bin
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-08-18 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: activerecord
|
|
@@ -563,6 +564,7 @@ metadata:
|
|
|
563
564
|
source_code_uri: https://github.com/BookingSync/dionysus-rb
|
|
564
565
|
changelog_uri: https://github.com/BookingSync/dionysus-rb/blob/master/CHANGELOG.md
|
|
565
566
|
rubygems_mfa_required: 'true'
|
|
567
|
+
post_install_message:
|
|
566
568
|
rdoc_options: []
|
|
567
569
|
require_paths:
|
|
568
570
|
- lib
|
|
@@ -577,7 +579,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
577
579
|
- !ruby/object:Gem::Version
|
|
578
580
|
version: '0'
|
|
579
581
|
requirements: []
|
|
580
|
-
rubygems_version:
|
|
582
|
+
rubygems_version: 3.5.22
|
|
583
|
+
signing_key:
|
|
581
584
|
specification_version: 4
|
|
582
585
|
summary: A framework on top of Karafka for Change Data Capture on the model level.
|
|
583
586
|
test_files: []
|