Package-level declarations

Types

Link copied to clipboard
interface CircuitBreaker

A circuit breaker that protects a downstream service from overload and prevents repeated calls to a failing service.

Link copied to clipboard

Configuration for a CircuitBreaker.

Link copied to clipboard
class CircuitBreakerOpenException(val currentState: CircuitState, val retryAfter: Duration?) : Exception

Exception thrown when the CircuitBreaker rejects a call without executing it.

Link copied to clipboard

Registry of named DefaultCircuitBreaker instances so multiple com.santimattius.resilient.ResilientPolicy configurations can share the same circuit breaker (e.g. one breaker per downstream service "payments", "db").

Link copied to clipboard
data class CircuitBreakerSnapshot(val state: CircuitState, val failureCount: Int, val successCount: Int)

Point-in-time snapshot of a CircuitBreaker for health/readiness and metrics.

Link copied to clipboard

Represents the three states of the circuit breaker.

Link copied to clipboard
class DefaultCircuitBreaker(config: CircuitBreakerConfig, timeSource: TimeSource = SystemTimeSource, onStateChanged: (CircuitState, CircuitState) -> Unit = { _, _ -> }) : CircuitBreaker

A default, thread-safe implementation of the CircuitBreaker interface.

Link copied to clipboard

A TimeSource implementation that uses the system clock.

Link copied to clipboard
interface TimeSource

An abstraction for a time source, providing the current time in milliseconds.