Created
October 25, 2022 12:15
-
-
Save kirshiyin89/a118445a64cbb1a18b467e71029e4d97 to your computer and use it in GitHub Desktop.
Example KafkaConsumerConfiguration for FixedBackOff strategy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
public class KafkaConsumerConfiguration { | |
@Bean | |
ConcurrentKafkaListenerContainerFactory<String, String> kafkaBlockingRetryContainerFactory() { | |
ConcurrentKafkaListenerContainerFactory<String, String> factory = new ConcurrentKafkaListenerContainerFactory<>(); | |
factory.setConsumerFactory(consumerFactory); | |
factory.setCommonErrorHandler(new DefaultErrorHandler( | |
new DeadLetterPublishingRecoverer(template), new FixedBackOff(5000, 3)) | |
); | |
return factory; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment