pro.aduki.core.retry.Circuit is a small three-state circuit breaker for fail-fast behaviour during outages. It is a utility: the SDK’s own clients do not wrap their calls in it, so use it around your own calls (for example a custom Dispatcher for the outbox).
package pro.aduki.core.retry
import pro.aduki.core.errors.AdukiException
class Circuit(
private val threshold: Int = 5,
private val timeout: Long = 15_000
) {
enum class State {
CLOSED,
OPEN,
HALF_OPEN
}
fun state(): State
fun success()
fun fail()
inline fun <T> execute(block: () -> T): T
}