Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Duplicate
-
2.3.0, 2.4.0
-
None
-
None
Description
One of the methods on the StreamsBuilder to create a KTable takes 3 arguments:
// code placeholder public synchronized <K, V> KTable<K, V> table(final String topic, final Consumed<K, V> consumed, final Materialized<K, V, KeyValueStore<Bytes, byte[]>> materialized)
The method code, however, overwrites the materialized Key & Value serde with the ones coming from consumed. There is already .table(String, Consumed) which constructs the table this way.
// code placeholder ... final ConsumedInternal<K, V> consumedInternal = new ConsumedInternal<>(consumed); materialized.withKeySerde(consumedInternal.keySerde()).withValueSerde(consumedInternal.valueSerde());
This stops use cases where a table should consume let's say Json but materialize it as Avro.
Suggestion
Drop the line overwriting the Key&Value serdes and ideally remove the `withKeySerde` and `withValueSerde` from Materialized - it could help avoid scenarios like this where state is changed unexpectedly and incorrectly.
Attachments
Issue Links
- duplicates
-
KAFKA-7777 Decouple topic serdes from materialized serdes
- Open