Skip to content

Instantly share code, notes, and snippets.

@kirshiyin89
Created October 25, 2022 12:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kirshiyin89/a118445a64cbb1a18b467e71029e4d97 to your computer and use it in GitHub Desktop.
Save kirshiyin89/a118445a64cbb1a18b467e71029e4d97 to your computer and use it in GitHub Desktop.
Example KafkaConsumerConfiguration for FixedBackOff strategy
@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