...
This KIP proposes the second option and does runtime key validation to avoid allocation of two Record with withKey()
(one for setting to Void null, and another for setting the previous key). Users will need to be aware that using processValues
will lead to runtime exceptions when changing the keys when not supposed to.
Adding a ValueRecord type for processValues
to avoid key change with Immutability
Another alternative to deal with key verification is to introduce a new type with an immutable key. This could remove some of the challenges but the record (ValueRecord in this case) would still be possible to recreate.
Adding another API will also increase the complexity of the processing layer.
References
- Cleanup old Processor work: https://issues.apache.org/jira/browse/KAFKA-12939
- Reference implementation: https://github.com/jeqo/kafka/tree/kstream-new-process