Class CircuitBreakerBundle<T extends io.dropwizard.Configuration>

  • All Implemented Interfaces:
    io.dropwizard.ConfiguredBundle<T>

    public class CircuitBreakerBundle<T extends io.dropwizard.Configuration>
    extends java.lang.Object
    implements io.dropwizard.ConfiguredBundle<T>
    Bundle that provides access to an implementation of the circuit breaker pattern to handle failures of downstream services. The bundle uses resilience4j and exposes instances of CircuitBreaker.

    The bundle allows to create circuit breakers, wrap classes in circuit breakers and registers prometheus metrics.

    • Method Detail

      • initialize

        public void initialize​(io.dropwizard.setup.Bootstrap<?> bootstrap)
        Specified by:
        initialize in interface io.dropwizard.ConfiguredBundle<T extends io.dropwizard.Configuration>
      • run

        public void run​(T configuration,
                        io.dropwizard.setup.Environment environment)
        Specified by:
        run in interface io.dropwizard.ConfiguredBundle<T extends io.dropwizard.Configuration>
      • createCircuitBreaker

        public CircuitBreakerConfigurationBuilder<io.dropwizard.Configuration> createCircuitBreaker​(java.lang.String name)
        Create a new circuit breaker builder.
        Parameters:
        name - The name of the circuit breaker, used in the metrics. Multiple calls with the same name return the same circuit breaker
        Returns:
        A circuit breaker builder.
      • getRegistry

        public io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry getRegistry()
        Returns the circuit breaker registry created by the bundle.
        Returns:
        The circuit breaker registry.