Skip to content

Commit

Permalink
DBZ-8282 Added record key to KafkaChangeConsumer ERROR log.
Browse files Browse the repository at this point in the history
  • Loading branch information
gmouss authored and jpechane committed Oct 2, 2024
1 parent 4d50b7a commit e4994bf
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
package io.debezium.server.kafka;

import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -103,7 +104,8 @@ public void handleBatch(final List<ChangeEvent<Object, Object>> records,
deliveryFutures.add(producer.send(new ProducerRecord<>(topicName, null, null, record.key(), record.value(), headers),
(metadata, exception) -> {
if (exception != null) {
LOGGER.error("Failed to send record to {}:", topicName, exception);
LOGGER.error("Failed to send record with key '{}' to {}:", new String((byte[]) record.key(), StandardCharsets.UTF_8), topicName,
exception);
throw new DebeziumException(exception);
}
else {
Expand Down

0 comments on commit e4994bf

Please sign in to comment.