Details
-
Bug
-
Resolution: Unresolved
-
Major
-
1.6.0.Final
-
None
-
False
-
False
-
Undefined
Description
When debezium is used with Spring Cloud Stream and Debezium's JsonSerde is used, Serde's configuration get overwritten.
Here line 425 calls configure method on already configured Serde with different set of properties.
valueSerde.configure(this.streamConfigGlobalProperties, false);
JsonSerde on line 54, discard old config and overwrites it with new config. Ideally it should merge old config with new one while maintaining precedence.
In my case from.field was removed from config when Spring Cloud Stream adds global configurations to existing Serde.
I worked around this issue by extending JsonSerde in following way. This may not be perfect but solves my issue for time being.
public class DebeziumJsonSerde<T> extends JsonSerde<T> { private final Map<String, Object> configs = new HashMap<>(); public DebeziumJsonSerde(Class<T> type) { super(type); } @Override public void configure(final Map<String, ?> configs, boolean isKey) { // First store config to a local map and then pass it on to the super method. // Everytime configure is called keep appending new config to old one and call super method. this.configs.putAll(configs); super.configure(this.configs, isKey); } }