DBZ-651 Support for JSON key and Avro value

This commit is contained in:
Jiri Pechanec 2020-05-11 15:59:34 +02:00 committed by Gunnar Morling
parent 7c56f39414
commit 8dd8189e67

View File

@ -105,6 +105,9 @@ else if (beans.size() > 1) {
if (keyFormat == Json.class && valueFormat == Json.class) {
builder = createJsonJson(consumer);
}
else if (keyFormat == Json.class && valueFormat == Avro.class) {
builder = createJsonAvro(consumer);
}
else if (keyFormat == Avro.class && valueFormat == Avro.class) {
builder = createAvroAvro(consumer);
}
@ -130,6 +133,12 @@ final DebeziumEngine.Builder<?> createAvroAvro(DebeziumEngine.ChangeConsumer<?>
.notifying((DebeziumEngine.ChangeConsumer<ChangeEvent<byte[], byte[]>>) consumer);
}
@SuppressWarnings("unchecked")
final DebeziumEngine.Builder<?> createJsonAvro(DebeziumEngine.ChangeConsumer<?> consumer) {
return DebeziumEngine.create(Json.class, Avro.class)
.notifying((DebeziumEngine.ChangeConsumer<ChangeEvent<String, byte[]>>) consumer);
}
private Properties configToProperties(Config config) {
final Properties props = new Properties();
for (String name : config.getPropertyNames()) {