Reputation: 40
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.
RetryingMessageListenerAdapter
's member stateful
as true through application.yml or ListenerContainerCustomizer
?RetryTemplate
using spring-cloud-stream-binder-kafka? I think the closest I found was to override max-attempts
to 1 in my @StreamRetryTemplate
.SeekToCurrentErrorHandler
provided by spring-kafka, is there any benefit or reason why I should set stateful
as true since SeekToCurrentErrorHandler
is already a stateful error handling mechanism?Please let me know.
Upvotes: 1
Views: 523
Reputation: 174759
Stateful retry is no longer needed now that the SeekToCurrentErrorHandler
has retry and backoff capabilities.
Yes, to disable retry in the binder, set maxAttempts=1
and configure the STCEH appropriately.
Upvotes: 1