mjsax commented on code in PR #17169:
URL: https://github.com/apache/kafka/pull/17169#discussion_r1757696994
##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/RecordCollectorImpl.java:
##########
@@ -298,19 +315,19 @@ private <K, V> void handleException(final
ProductionExceptionHandler.Serializati
final Integer partition,
final Long timestamp,
final String processorNodeId,
- final InternalProcessorContext<Void,
Void> context,
+ final RecordContext recordContext,
final RuntimeException
serializationException) {
log.debug(String.format("Error serializing record for topic %s",
topic), serializationException);
final DefaultErrorHandlerContext errorHandlerContext = new
DefaultErrorHandlerContext(
null, // only required to pass for DeserializationExceptionHandler
- context.recordContext().topic(),
- context.recordContext().partition(),
- context.recordContext().offset(),
- context.recordContext().headers(),
+ recordContext != null ? recordContext.topic() : null,
+ recordContext != null ? recordContext.partition() : -1,
+ recordContext != null ? recordContext.offset() : -1,
+ recordContext != null ? recordContext.headers() : new
RecordHeaders(),
Review Comment:
Not sure how this would work? -- Yes, we need to check if `context ==
null`, and for this case set `recordContext = null` instead of `recordContext =
context.recordContext()`. But not sure how I can avoid the `recordContext` null
check?
We could do:
```
final DefaultErrorHandlerContext errorHandlerContext;
if (recordContext != null) {
errorHandlerContext = new DefaultErrorHandlerContext(
null, // only required to pass for DeserializationExceptionHandler
ecordContext.topic(),
recordContext.partition(),
recordContext.offset(),
recordContext.headers(),
processorNodeId,
taskId,
recordContext.timestamp()
);
} else {
errorHandlerContext = new DefaultErrorHandlerContext(
null, // only required to pass for DeserializationExceptionHandler
null,
-1,
-1,
new RecordHeaders(),
processorNodeId,
taskId,
-1L
);
}
```
and/or extract into helper method.
But not sure if this changes much?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]