Functions to create and execute circuit breakers.
Functions to create and execute circuit breakers.
(add-configuration! name config)
(add-configuration! registry name config)
Adds config
to the registry
under the name
.
Uses default-registry
if registry
is not provided.
Adds `config` to the `registry` under the `name`. Uses [[default-registry]] if `registry` is not provided.
(all-circuit-breakers)
(all-circuit-breakers registry)
Gets all the circuit breakers in registry
.
Uses default-registry
if registry
is not provided.
Gets all the circuit breakers in `registry`. Uses [[default-registry]] if `registry` is not provided.
(circuit-breaker name)
(circuit-breaker name config)
Creates a circuit breaker with name
and config
.
Creates a circuit breaker with `name` and `config`.
(circuit-breaker! name)
(circuit-breaker! registry name)
(circuit-breaker! registry name config)
Creates or fetches a circuit breaker with name
and config
and stores it
in registry
.
The config value can be either a config map or the name of a config map stored in the registry. If the circuit breaker already exists in the registry, the config value is ignored.
Uses default-registry
if registry
is not provided.
Creates or fetches a circuit breaker with `name` and `config` and stores it in `registry`. The config value can be either a config map or the name of a config map stored in the registry. If the circuit breaker already exists in the registry, the config value is ignored. Uses [[default-registry]] if `registry` is not provided.
(close! circuit-breaker)
Transitions circuit-breaker
to the :closed
state.
Transitions `circuit-breaker` to the `:closed` state.
The default registry for storing circuit breakers and configurations.
The default registry for storing circuit breakers and configurations.
(disable! circuit-breaker)
Transitions circuit-breaker
to the :disabled
state.
In the :disabled
state, the circuit breaker will not automatically
transition to other states, collect metrics, or send events. All calls will be
allowed to pass.
You must manually transition out of the :disabled
state.
Transitions `circuit-breaker` to the `:disabled` state. In the `:disabled` state, the circuit breaker will not automatically transition to other states, collect metrics, or send events. All calls will be allowed to pass. You must manually transition out of the `:disabled` state.
(emit-events! circuit-breaker
out-chan
&
{:keys [only exclude] :or {exclude []}})
Offers events circuit-breaker
to out-chan
.
The event types are identified by event-types
.
This function also accepts :only
and :exclude
keyword params that are
sequences of the event types that should be included or excluded,
respectively.
Offers events `circuit-breaker` to `out-chan`. The event types are identified by [[event-types]]. This function also accepts `:only` and `:exclude` keyword params that are sequences of the event types that should be included or excluded, respectively.
(emit-registry-events! out-chan)
(emit-registry-events! registry
out-chan
&
{:keys [only exclude] :or {exclude []}})
Offers registry events to out-chan
.
The event types are identified by registry-event-types
.
This function also accepts :only
and :exclude
keyword params that are
sequences of the event types that should be included or excluded,
respectively.
Uses default-registry
if registry
is not provided.
Offers registry events to `out-chan`. The event types are identified by [[registry-event-types]]. This function also accepts `:only` and `:exclude` keyword params that are sequences of the event types that should be included or excluded, respectively. Uses [[default-registry]] if `registry` is not provided.
(execute circuit-breaker f & args)
Apply args
to f
within a context protected by circuit-breaker
.
Apply `args` to `f` within a context protected by `circuit-breaker`.
(find name)
(find registry name)
Finds the circuit breaker identified by name
in registry
.
Uses default-registry
if registry
is not provided.
Finds the circuit breaker identified by `name` in `registry`. Uses [[default-registry]] if `registry` is not provided.
(force-open! circuit-breaker)
Transitions circuit-breaker
to the :forced-open
state.
In the :forced-open
state, the circuit breaker will not automatically
transition to other states, collect metrics, or send events. No call will be
allowed to pass.
You must manually transition out of the :forced-open
state.
Transitions `circuit-breaker` to the `:forced-open` state. In the `:forced-open` state, the circuit breaker will not automatically transition to other states, collect metrics, or send events. No call will be allowed to pass. You must manually transition out of the `:forced-open` state.
(half-open! circuit-breaker)
Transitions circuit-breaker
to the :half-open
state.
Transitions `circuit-breaker` to the `:half-open` state.
(metrics-only! circuit-breaker)
Transitions circuit-breaker
to the :metrics-only
state.
In the :metrics-only
state, the circuit breaker will not transition to
other states, but it will continue to capture metrics and publish events.
You must manually transition out of the `:metrics-only`` state.
Transitions `circuit-breaker` to the `:metrics-only` state. In the `:metrics-only` state, the circuit breaker will not transition to other states, but it will continue to capture metrics and publish events. You must manually transition out of the `:metrics-only`` state.
(name circuit-breaker)
Gets the name of circuit-breaker
.
Gets the name of `circuit-breaker`.
(open! circuit-breaker)
Transitions circuit-breaker
to the :open
state.
Transitions `circuit-breaker` to the `:open` state.
(permitting-calls? circuit-breaker)
Indicates whether circuit-breaker
is allowing calls to be executed.
Indicates whether `circuit-breaker` is allowing calls to be executed.
(registry)
(registry configs-map)
Creates a registry with default values or using a map of name/config-map pairs.
Creates a registry with default values or using a map of name/config-map pairs.
The event types that can be raised by a registry.
The event types that can be raised by a registry.
(remove! name)
(remove! registry name)
Removes the circuit breaker idenfitied by name
from registry
.
Uses default-registry
if registry
is not provided.
Removes the circuit breaker idenfitied by `name` from `registry`. Uses [[default-registry]] if `registry` is not provided.
(replace! name circuit-breaker)
(replace! registry name circuit-breaker)
Replaces the circuit breaker identified by name
in registry
with the specified circuit-breaker
.
Uses default-registry
if registry
is not provided.
Replaces the circuit breaker identified by `name` in `registry` with the specified `circuit-breaker`. Uses [[default-registry]] if `registry` is not provided.
(reset! circuit-breaker)
Resets circuit-breaker
to its original state.
Resets all metrics collected and effectively empties the contents of its ring buffers.
Resets `circuit-breaker` to its original state. Resets all metrics collected and effectively empties the contents of its ring buffers.
(state circuit-breaker)
Gets the current state of circuit-breaker
.
Gets the current state of `circuit-breaker`.
(with-circuit-breaker circuit-breaker & body)
Executes body
within a context protected by circuit-breaker
.
circuit-breaker
is either a circuit breaker or the name of one in the
default registry. If you provide a name and a circuit breaker of that name
does not already exist in the default registry, one will be created with the
:default
config.
Executes `body` within a context protected by `circuit-breaker`. `circuit-breaker` is either a circuit breaker or the name of one in the default registry. If you provide a name and a circuit breaker of that name does not already exist in the default registry, one will be created with the `:default` config.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close