1
0
mirror of https://github.com/pcvolkmer/etl-processor.git synced 2025-04-19 17:26:51 +00:00

feat: add max-retry-attempts config option

This commit is contained in:
Paul-Christian Volkmer 2024-02-29 08:29:26 +01:00
parent 50b8f7bbd4
commit 61e5273158
2 changed files with 4 additions and 3 deletions

View File

@ -30,7 +30,8 @@ data class AppConfigProperties(
replacement = "app.pseudonymize.generator"
)
var pseudonymizer: PseudonymGenerator = PseudonymGenerator.BUILDIN,
var transformations: List<TransformationProperties> = listOf()
var transformations: List<TransformationProperties> = listOf(),
var maxRetryAttempts: Int = 3
) {
companion object {
const val NAME = "app"

View File

@ -113,11 +113,11 @@ class AppConfiguration {
}
@Bean
fun retryTemplate(): RetryTemplate {
fun retryTemplate(configProperties: AppConfigProperties): RetryTemplate {
return RetryTemplateBuilder()
.notRetryOn(IllegalArgumentException::class.java)
.exponentialBackoff(2.seconds.toJavaDuration(), 1.25, 5.seconds.toJavaDuration())
.customPolicy(SimpleRetryPolicy(3))
.customPolicy(SimpleRetryPolicy(configProperties.maxRetryAttempts))
.withListener(object : RetryListener {
override fun <T : Any, E : Throwable> onError(
context: RetryContext,