1

I am using spring-cloud-stream-binder-kafka version 3.2.6 in my application. I have enabled the batch-mode so that I should get the messages in batches. While handling DLQ scenario I observed that, In my batch if I have 3 messages and if my last message fail then entire batch goes to DLQ. Although I am throwing BatchListenerFailedException with the correct index of the message.

After debugging further I observed in Class org.springframework.cloud.stream.binder.kafka KafkaMessageChannelBinder method getErrorMessageHandler throws ClassCastException (Can not cast LinkedList to ConsumerRecord). Below is that line.

ConsumerRecord<Object, Object> record = StaticMessageHeaderAccessor.getSourceData(message);

Method StaticMessageHeaderAccessor.getSourceData(message) returns list of ConsumerRecord but in the code it is expecting single consumer record. Is this a bug? If not can somebody help me to find how to resolve this issue.

Appreciate your early response.

Thanks

Sach
  • 41
  • 4
  • Ignore this issue. It was a configuration issue from my side. I have batch-mode enabled and I have enabled enableDLQ as well. After disabling enableDLQ it worked. – Sach Feb 01 '23 at 10:26
  • I faced the same issue. If you disable dlq then does that mean it does not support dlq for batch consumption? How do I achieve dlq in batch mode on? – Darpan27 Feb 09 '23 at 04:43
  • follow https://docs.spring.io/spring-kafka/docs/2.7.x/reference/html/#dead-letters for dlq to handle in batch mode – Sach Feb 14 '23 at 11:14

0 Answers0