Closed ePaul closed 1 year ago
Implementation plan
For the compatible API, I see these options here:
fire*
methods to EventLogWriter, with an additional compactionKey parameter.BiFunction<String, Object, String>
), which is then called internally when any of the fire*
methods are called.
Function<Object, String>
) per event type.In addition, we need this:
So I built two variants of this:
registerCompactionKeyExtractor
method on the EventLogWriter (→ release candidate 21.0.0-RC3a), andCompactionKeyExtractor
(→ release candidate 21.0.0-RC3b).We tried this out in an internal service, and it the second way looks cleaner, so I'd suggest to go for this way.
Background / Status quo
Currently this library does not support submitting events to compacted event types, as it is missing the
partition_compaction_key
in the metadata object.This is justified by these paragraphs in the README:
There are some cases where the out-of-order submission is less critical – e.g. when you have occasionally have groups of events for different entities (and thus different compaction keys), and a long time in-between those groups. Here is it quite unlikely that events for the same entity are submitted out of order, and compaction is also quite useful.
Possible workarounds for this situation:
Suggestion