Home

CircuitBreakerRegistry

CircuitBreakerRegistry is a component of the Resilience4j library that serves as a central registry for CircuitBreaker instances. It provides a name-based repository where circuit breakers can be created, configured, and reused across an application. The registry is designed to ensure that a single CircuitBreaker instance is associated with a given name, promoting consistent behavior and reducing duplication.

Construction and configuration

The registry can be created with a default configuration or with a custom global configuration. When a

Operations and behavior

The registry maintains an internal storage, typically a thread-safe map, linking names to CircuitBreaker instances. It

Usage

A typical usage pattern is to create a registry and obtain breakers by name, reusing them across

Context

CircuitBreakerRegistry is part of the Resilience4j circuit breaker module. It complements the per-breaker state machine (closed,

circuit
breaker
is
requested
by
name,
the
registry
either
returns
an
existing
instance
or
creates
a
new
one
using
the
provided
configuration
(default
or
per-breaker).
This
enables
both
uniform
global
settings
and
per-breaker
customization
when
needed.
supports
retrieval
by
name
and,
in
many
versions,
creation
with
an
explicit
CircuitBreakerConfig.
It
can
also
provide
access
to
all
registered
breakers
and,
depending
on
the
version,
may
support
removal
of
breakers
from
the
registry.
modules.
For
example,
a
registry
created
with
defaults
can
supply
a
CircuitBreaker
for
a
service
by
name,
and
a
custom
configuration
can
be
supplied
to
a
specific
breaker
if
different
behavior
is
required.
open,
half-open)
by
providing
centralized
management,
reuse,
and
consistent
configuration
across
an
application.