I am wondering if there is a way to enable Stateful RetryTemplate using spring-cloud-stream-binder-kafka.
I noticed that there is a constructor
RetryingMessageListenerAdapter(MessageListener<K, V> messageListener, RetryTemplate retryTemplate, RecoveryCallback<? extends Object> recoveryCallback, boolean stateful)
Debugging through this code, I noticed that boolean value false
is passed into stateful
parameter using spring-cloud-stream-binder-kafka.
Related links: KafkaMessageDrivenChannelAdapter.java, RetryingMessageListenerAdapter.java
I have a few questions regarding this topic.
- Is there a way to set
RetryingMessageListenerAdapter
's memberstateful
as true through application.yml orListenerContainerCustomizer
? - Is there a way to disable
RetryTemplate
using spring-cloud-stream-binder-kafka? I think the closest I found was to overridemax-attempts
to 1 in my@StreamRetryTemplate
. - If I am using
SeekToCurrentErrorHandler
provided by spring-kafka, is there any benefit or reason why I should setstateful
as true sinceSeekToCurrentErrorHandler
is already a stateful error handling mechanism?
Please let me know.