ru.tinkoff.kora.resilient.retry.RetryModule Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of resilient-kora Show documentation
Show all versions of resilient-kora Show documentation
Kora resilient-kora module
The newest version!
package ru.tinkoff.kora.resilient.retry;
import jakarta.annotation.Nullable;
import ru.tinkoff.kora.application.graph.All;
import ru.tinkoff.kora.config.common.Config;
import ru.tinkoff.kora.config.common.extractor.ConfigValueExtractor;
public interface RetryModule {
default RetryConfig koraRetryableConfig(Config config, ConfigValueExtractor extractor) {
var value = config.get("resilient");
return extractor.extract(value);
}
default RetryManager koraRetryableManager(All failurePredicates,
RetryConfig config,
@Nullable RetryMetrics metrics) {
return new KoraRetryManager(config, failurePredicates,
metrics == null
? new NoopRetryMetrics()
: metrics);
}
default RetryPredicate koraRetryFailurePredicate() {
return new KoraRetryPredicate();
}
default KoraRetryReactorBuilder koraRetryReactorBuilder(All failurePredicates,
RetryConfig config,
@Nullable RetryMetrics metrics) {
return new KoraRetryReactorBuilder(config, failurePredicates,
metrics == null
? new NoopRetryMetrics()
: metrics);
}
}