rimless 3.2.0 → 3.3.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 +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +7 -7
- data/lib/rimless/configuration.rb +5 -0
- data/lib/rimless/consumer/avro_deserializer.rb +36 -0
- data/lib/rimless/version.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8b258d50dc6020e58639709dda7cc93bcc0deaf96d53defd689bcc10ae270041
|
|
4
|
+
data.tar.gz: 82f0ef8f8bed2b01f4fc2577c7a1ca84b13da5526420f264f5d13cbb9afd7af8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ad93ec539b08cfa0b34daf4cb426a2da1c6c781fa0779e256600a60420536239b83d194ff5a58cfce8f066a4fe644869367bd510c710f86ce8be62fec2e43776
|
|
7
|
+
data.tar.gz: 1ce1a114e929c2b5fb219343bd42dd44efccd3aa893b9de96445876c94a0f9eb6c80e3aa133e7cf6d1e3b4bb1c710297ad5f12cb313146ad654d23a404d9c8fa
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
* TODO: Replace this bullet point with an actual description of a change.
|
|
4
4
|
|
|
5
|
+
### 3.3.0 (16 April 2026)
|
|
6
|
+
|
|
7
|
+
* Added a new configuration (`avro_deserializer_parse_datetimes`) which allows
|
|
8
|
+
to configure the default Apache Avro deserializer to automatically parse
|
|
9
|
+
date/time/datetime's from deeply nested strings (disabled by default for
|
|
10
|
+
compatibility) ([#76](https://github.com/hausgold/rimless/pull/76))
|
|
11
|
+
|
|
5
12
|
### 3.2.0 (7 April 2026)
|
|
6
13
|
|
|
7
14
|
* Restored non-buffered (`$stdout.sync = true`) logging to stdout ([#75](https://github.com/hausgold/rimless/pull/75))
|
data/README.md
CHANGED
|
@@ -322,13 +322,13 @@ architecture looks like this:
|
|
|
322
322
|
|
|
|
323
323
|
v
|
|
324
324
|
+-----------------------------+
|
|
325
|
-
| Karafka/Rimless Consumer |
|
|
326
|
-
| Shares a single consumer |--->| ActiveJob
|
|
327
|
-
| group, multiple processes | | Runs the consumer class (children
|
|
328
|
-
+-----------------------------+ | of Rimless::
|
|
329
|
-
| message (Rimless::
|
|
330
|
-
| one message per job
|
|
331
|
-
|
|
325
|
+
| Karafka/Rimless Consumer | +----------------------------------------+
|
|
326
|
+
| Shares a single consumer |--->| ActiveJob |
|
|
327
|
+
| group, multiple processes | | Runs the consumer class (children |
|
|
328
|
+
+-----------------------------+ | of Rimless::Consumer::Base) for each |
|
|
329
|
+
| message (Rimless::Consumer::Job), |
|
|
330
|
+
| one message per job |
|
|
331
|
+
+----------------------------------------+
|
|
332
332
|
```
|
|
333
333
|
|
|
334
334
|
This architecture allows the consumer process to run mostly non-blocking and
|
|
@@ -134,6 +134,11 @@ module Rimless
|
|
|
134
134
|
Rimless::Consumer::AvroDeserializer
|
|
135
135
|
end
|
|
136
136
|
|
|
137
|
+
# This configuration allows to configure the default Apache Avro
|
|
138
|
+
# deserializer to automatically parse date/time/datetime's from deeply
|
|
139
|
+
# nested strings.
|
|
140
|
+
config_accessor(:avro_deserializer_parse_datetimes) { false }
|
|
141
|
+
|
|
137
142
|
# The ActiveJob job queue to use for consuming jobs
|
|
138
143
|
config_accessor(:consumer_job_queue) do
|
|
139
144
|
ENV.fetch(
|
|
@@ -4,6 +4,12 @@ module Rimless
|
|
|
4
4
|
module Consumer
|
|
5
5
|
# A custom Apache Avro compatible message deserializer.
|
|
6
6
|
class AvroDeserializer
|
|
7
|
+
# The ISO8601 date/time format
|
|
8
|
+
ISO_TIME_FORMAT = /\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?/m
|
|
9
|
+
|
|
10
|
+
# The ISO8601 date format
|
|
11
|
+
ISO_DATE_FORMAT = /\A\d{4}-\d{2}-\d{2}\Z/m
|
|
12
|
+
|
|
7
13
|
# Deserialize an Apache Avro encoded Apache Kafka message.
|
|
8
14
|
#
|
|
9
15
|
# @param message [Karafka::Messages::Message] the Karafka message to
|
|
@@ -25,6 +31,36 @@ module Rimless
|
|
|
25
31
|
.then { |data| data.transform_keys { |key| key.delete('\\') } }
|
|
26
32
|
.then { |data| Unsparsify(data, sparse_array: true) }
|
|
27
33
|
.deep_symbolize_keys
|
|
34
|
+
.then do |obj|
|
|
35
|
+
# When the configuration says we should not parse datetimes,
|
|
36
|
+
# we skip further processing
|
|
37
|
+
next obj \
|
|
38
|
+
unless Rimless.configuration.avro_deserializer_parse_datetimes
|
|
39
|
+
|
|
40
|
+
# Otherwise we parse them
|
|
41
|
+
parse_timestamps!(obj)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Search recursively through the given object for ISO date/time string
|
|
46
|
+
# values and replace them with their parsed date representation. This
|
|
47
|
+
# works on hashes, arrays, and combinations of this.
|
|
48
|
+
#
|
|
49
|
+
# @param value [Mixed] the input to process
|
|
50
|
+
# @return [Mixed] the processed input
|
|
51
|
+
def parse_timestamps!(obj)
|
|
52
|
+
case obj
|
|
53
|
+
when Hash
|
|
54
|
+
obj.each { |key, val| obj[key] = parse_timestamps!(val) }
|
|
55
|
+
when Array
|
|
56
|
+
obj.each_with_index { |cur, idx| obj[idx] = parse_timestamps!(cur) }
|
|
57
|
+
when ISO_TIME_FORMAT
|
|
58
|
+
Time.zone.parse(obj)
|
|
59
|
+
when ISO_DATE_FORMAT
|
|
60
|
+
Date.parse(obj)
|
|
61
|
+
else
|
|
62
|
+
obj
|
|
63
|
+
end
|
|
28
64
|
end
|
|
29
65
|
end
|
|
30
66
|
end
|
data/lib/rimless/version.rb
CHANGED