DBZ-3827 Debezium Server Kinesis Sink Cannot Handle Null Events

This commit is contained in:
Chris Baumbauer 2021-08-05 11:41:17 -07:00 committed by Gunnar Morling
parent 07d937ee0a
commit 7b707a0b9b

View File

@ -100,10 +100,15 @@ public void handleBatch(List<ChangeEvent<Object, Object>> records, RecordCommitt
throws InterruptedException {
for (ChangeEvent<Object, Object> record : records) {
LOGGER.trace("Received event '{}'", record);
Object rv = record.value();
if (rv == null) {
rv = "";
}
final PutRecordRequest putRecord = PutRecordRequest.builder()
.partitionKey((record.key() != null) ? getString(record.key()) : nullKey)
.streamName(streamNameMapper.map(record.destination()))
.data(SdkBytes.fromByteArray(getBytes(record.value())))
.data(SdkBytes.fromByteArray(getBytes(rv)))
.build();
client.putRecord(putRecord);
committer.markProcessed(record);