Skip to content

Spring kafka should handle some fatal exceptions like InvalidPidMappingException, UnknownProducerIdException. #1369

Closed
@bartosz-stasikowski-projectdrgn

Description

Affects Version(s): 2.3.1.RELEASE

🎁 Enhancement
Spring kafka should handle some fatal exceptions like InvalidPidMappingException, UnknownProducerIdException.

Context: processing messages with transactions in non batch mode
Problem: Some exceptions like InvalidPidMappingException, UnknownProducerIdException are fatal and will cause KafkaMessageListenerContainer to fail every time polled record is processed

Usecase:

  1. Records are polled
  2. Transaction fails because of InvalidPidMappingException or UnknownProducerIdException when processing record
  3. Rollback processing fails for InvalidPidMappingException or will send message to DLT for UnknownProducerIdException (if configured to do so)
  4. Next poll will get another record which will have the same problem because exception is fatal
  • in case of InvalidPidMappingException records will be processed after service is restarted or the is a rebalance
  • in case of UnknownProducerIdException records wont be processed again since offsets were commited in rollback processing

Currently InvalidPidMappingException exception can be handled in ErrorHandler but the only thing I can think of is to restart listener container.
For UnknownProducerIdException it is possible to not perform rollback processing and handle in the same way as InvalidPidMappingException in error handler.
This is strange and it should be handled by spring-kafka since it is a common problem when using transactions.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions