Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

GH-3409: Improve exceptions during retry #3421

Merged
merged 2 commits into from
Aug 14, 2024

Conversation

sobychacko
Copy link
Contributor

Fixes: #3409

  • During error handling, records in retry are throwing KafkaException after seeking that causes the exception to get logged which maybe misleading. It seems to indicate that the error handling process itself thew the exception, while the exception was thrown in order to prevent accidental committing of a not-yet recovered record. Change this exception during seeks in retry while handling error from KafkaException to a new framework-only used exception - RecordInRetryException that simply logs the message at INFO level.

Fixes: spring-projects#3409

- During error handling, records in retry are throwing `KafkaException` after seeking
  that causes the exception to get logged which maybe misleading. It seems to indicate
  that the error handling process itself thew the exception, while the exception was thrown
  in order to prevent accidental committing of a not-yet recovered record.
  Change this exception during seeks in retry while handling error from `KafkaException`
  to a new framework-only used exception - `RecordInRetryException` that simply logs the
  message at INFO level.
Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And yes: I don't think there is anything to mention in the docs 😄

@@ -2212,6 +2212,10 @@ private RuntimeException doInvokeBatchListener(final ConsumerRecords<K, V> recor
invokeBatchErrorHandler(records, recordList, e);
commitOffsetsIfNeededAfterHandlingError(records);
}
catch (RecordInRetryException rire) {
rire.selfLog(this.logger);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't do this, but just this.logger.info("BLAH-BLAH", rire)


void selfLog(LogAccessor logger) {
logger.info(this.message);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just nit-pic: every member in the class must be surrounded with blank lines, even the last method of the last inner class.

@artembilan artembilan enabled auto-merge (squash) August 14, 2024 17:45
@artembilan artembilan merged commit bcb462e into spring-projects:main Aug 14, 2024
3 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error handler throws an exception on blocking retries
2 participants