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

ru.tinkoff.kora.resilient.circuitbreaker.CircuitBreakerModule Maven / Gradle / Ivy

The newest version!
package ru.tinkoff.kora.resilient.circuitbreaker;

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 CircuitBreakerModule {
    default CircuitBreakerConfig koraCircuitBreakerConfig(Config config, ConfigValueExtractor extractor) {
        var resilient = config.get("resilient");
        return extractor.extract(resilient);
    }

    default CircuitBreakerManager koraCircuitBreakerManager(CircuitBreakerConfig config,
                                                            All failurePredicates,
                                                            @Nullable CircuitBreakerMetrics metrics) {
        return new KoraCircuitBreakerManager(config, failurePredicates,
            (metrics == null)
                ? new NoopCircuitBreakerMetrics()
                : metrics);
    }

    default CircuitBreakerPredicate koraDefaultCircuitBreakerFailurePredicate() {
        return new KoraCircuitBreakerPredicate();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy