All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ru.tinkoff.kora.resilient.fallback.FallbackModule Maven / Gradle / Ivy

There is a newer version: 1.1.17
Show newest version
package ru.tinkoff.kora.resilient.fallback;

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 FallbackModule {

    default FallbackConfig koraFallbackConfig(Config config, ConfigValueExtractor extractor) {
        var value = config.get("resilient");
        return extractor.extract(value);
    }

    default FallbackManager koraFallbackManager(FallbackConfig config,
                                                All failurePredicates,
                                                @Nullable FallbackMetrics metrics) {
        return new KoraFallbackManager(config, failurePredicates,
            (metrics == null)
                ? NoopFallbackMetrics.INSTANCE
                : metrics);
    }

    default FallbackPredicate defaultFallbackFailurePredicate() {
        return new KoraFallbackPredicate();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy