C0urante commented on code in PR #15154: URL: https://github.com/apache/kafka/pull/15154#discussion_r1450843684
########## connect/runtime/src/main/java/org/apache/kafka/connect/runtime/errors/DeadLetterQueueReporter.java: ########## @@ -121,20 +121,22 @@ public static DeadLetterQueueReporter createAndSetup(Map<String, Object> adminPr /** * Write the raw records into a Kafka topic and return the producer future. * - * @param context processing context containing the raw record at {@link ProcessingContext#consumerRecord()}. + * @param context processing context containing the raw record at {@link ProcessingContext#original()}. * @return the future associated with the writing of this record; never null */ - public Future<RecordMetadata> report(ProcessingContext context) { + @SuppressWarnings("unchecked") + public Future<RecordMetadata> report(ProcessingContext<?> context) { if (dlqTopicName.isEmpty()) { return CompletableFuture.completedFuture(null); } errorHandlingMetrics.recordDeadLetterQueueProduceRequest(); - ConsumerRecord<byte[], byte[]> originalMessage = context.consumerRecord(); - if (originalMessage == null) { + if (!(context.original() instanceof ConsumerRecord)) { Review Comment: Ah, nice. I'll mark this resolved and look forward to the refactor 👍 ########## connect/runtime/src/main/java/org/apache/kafka/connect/runtime/errors/DeadLetterQueueReporter.java: ########## @@ -121,20 +121,22 @@ public static DeadLetterQueueReporter createAndSetup(Map<String, Object> adminPr /** * Write the raw records into a Kafka topic and return the producer future. * - * @param context processing context containing the raw record at {@link ProcessingContext#consumerRecord()}. + * @param context processing context containing the raw record at {@link ProcessingContext#original()}. * @return the future associated with the writing of this record; never null */ - public Future<RecordMetadata> report(ProcessingContext context) { + @SuppressWarnings("unchecked") + public Future<RecordMetadata> report(ProcessingContext<?> context) { if (dlqTopicName.isEmpty()) { return CompletableFuture.completedFuture(null); } errorHandlingMetrics.recordDeadLetterQueueProduceRequest(); - ConsumerRecord<byte[], byte[]> originalMessage = context.consumerRecord(); - if (originalMessage == null) { + if (!(context.original() instanceof ConsumerRecord)) { errorHandlingMetrics.recordDeadLetterQueueProduceFailed(); return CompletableFuture.completedFuture(null); } + ProcessingContext<ConsumerRecord<byte[], byte[]>> sinkContext = (ProcessingContext<ConsumerRecord<byte[], byte[]>>) context; Review Comment: Hmmm, I was wondering if a consumer interceptor could potentially return a subclass of `ConsumerRecord` but this doesn't seem possible at the moment. Fine as-is, then 👍 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org