Liking cljdoc? Tell your friends :D

resilience-clj.circuit-breaker


createclj

(create opts)

Create a Circuit Breaker instance. opts: :failure-threshold — consecutive failure count threshold (default: 5) :reset-timeout-ms — wait time in ms before open -> half-open (default: 10000) :half-open-calls — successes needed in half-open to close (default: 1) :failure? — return-value-based failure predicate (default: (constantly false)) :on-state-change — (fn [old-status new-status]) state transition callback

Create a Circuit Breaker instance.
opts:
  :failure-threshold — consecutive failure count threshold (default: 5)
  :reset-timeout-ms  — wait time in ms before open -> half-open (default: 10000)
  :half-open-calls   — successes needed in half-open to close (default: 1)
  :failure?          — return-value-based failure predicate (default: (constantly false))
  :on-state-change   — (fn [old-status new-status]) state transition callback
sourceraw docstring

reset!clj

(reset! breaker)

Manually reset the Circuit Breaker to :closed.

Manually reset the Circuit Breaker to :closed.
sourceraw docstring

shutdown!clj

(shutdown! breaker)

Stop the go-loop and release resources. Idempotent.

Stop the go-loop and release resources. Idempotent.
sourceraw docstring

statusclj

(status breaker)

Return the current Circuit Breaker state: :closed | :open | :half-open

Return the current Circuit Breaker state: :closed | :open | :half-open
sourceraw docstring

wrapclj

(wrap breaker f)

Wrap function f with the Circuit Breaker.

  • :closed / :half-open: executes f, records success/failure
  • :open: skips f, returns {:resilience/rejected :circuit-open} Exceptions are re-thrown after being counted as failures.
Wrap function f with the Circuit Breaker.
- :closed / :half-open: executes f, records success/failure
- :open: skips f, returns {:resilience/rejected :circuit-open}
Exceptions are re-thrown after being counted as failures.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close