You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix SmartMessageConverter support in batch listeners
BatchMessagingMessageConverter was missing setMessagingConverter() method that exists in MessagingMessageConverter, causing SmartMessageConverter configured via @KafkaListener(contentTypeConverter) to be ignored in batch listeners.
This inconsistency between regular and batch listeners leads to ClassCastException when byte[] values aren't converted to the expected String type, breaking the contract that SmartMessageConverter should work the same way regardless of listener type.
The fix ensures SmartMessageConverter propagation works consistently by:
- Adding setMessagingConverter() to BatchMessagingMessageConverter that delegates to underlying MessagingMessageConverter
- Overriding setMessagingConverter() in BatchMessagingMessageListenerAdapter to propagate the converter to batch converter
- Maintaining the same SmartMessageConverter behavior between regular and batch listeners
FixesGH-4097
Signed-off-by: Jujuwryy <[email protected]>
Copy file name to clipboardExpand all lines: spring-kafka/src/main/java/org/springframework/kafka/listener/adapter/BatchMessagingMessageListenerAdapter.java
Copy file name to clipboardExpand all lines: spring-kafka/src/main/java/org/springframework/kafka/support/converter/BatchMessagingMessageConverter.java
0 commit comments