Skip to content

Commit dc03d98

Browse files
garyrussellartembilan
authored andcommitted
GH-1219: Assert no retry with batch listener
Fixes #1219 Avoid `ClassCastException`.
1 parent 604ecce commit dc03d98

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

spring-kafka/src/main/java/org/springframework/kafka/config/AbstractKafkaListenerEndpoint.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,9 @@ private void setupMessageListener(MessageListenerContainer container, MessageCon
473473
Object messageListener = adapter;
474474
Assert.state(messageListener != null,
475475
() -> "Endpoint [" + this + "] must provide a non null message listener");
476+
Assert.state(this.retryTemplate == null || !this.batchListener,
477+
"A 'RetryTemplate' is not supported with a batch listener; consider configuring the container "
478+
+ "with a suitably configured 'SeekToCurrentBatchErrorHandler' instead");
476479
if (this.retryTemplate != null) {
477480
messageListener = new RetryingMessageListenerAdapter<>((MessageListener<K, V>) messageListener,
478481
this.retryTemplate, this.recoveryCallback, this.statefulRetry);

0 commit comments

Comments
 (0)