Class Resilience4jModule

java.lang.Object
com.google.inject.AbstractModule
ratpack.guice.ConfigurableModule<Resilience4jConfig>
io.github.resilience4j.ratpack.Resilience4jModule
All Implemented Interfaces:
com.google.inject.Module

public class Resilience4jModule
extends ratpack.guice.ConfigurableModule<Resilience4jConfig>
This module registers class and method interceptors for bulkheads, circuit breakers, rate limiters, and retries.

This module also registers metrics: - bulkhead, circuitbreaker, ratelimiter, and retry metrics with dropwizard metrics, if enabled. - circuitbreaker, ratelimiter, and retry metrics with prometheus, if enabled.

Only enable metrics if you have dependencies for resilience4j-metrics in the classpath and an instance of MetricRegistry is bound (usually this will happen when installing DropwizardMetricsModule). This must be done manually, since guice doesn't know if dropwizard is on the runtime classpath.

Only enable prometheus if you have a dependency on resilience4j-prometheus in the classpath and an instance of CollectorRegistry is bound. This must be done manually, since guice doesn't know if prometheus is on the runtime classpath.

Also note that for this to work, CircuitBreaker, RateLimiter, and Retry instances must be created before the respective registries are bound.

  • Constructor Summary

    Constructors 
    Constructor Description
    Resilience4jModule()  
  • Method Summary

    Modifier and Type Method Description
    protected void configure()  

    Methods inherited from class ratpack.guice.ConfigurableModule

    configure, createConfig, defaultConfig, setConfig

    Methods inherited from class com.google.inject.AbstractModule

    addError, addError, addError, bind, bind, bind, bindConstant, binder, bindInterceptor, bindListener, bindListener, bindScope, configure, convertToTypes, currentStage, getMembersInjector, getMembersInjector, getProvider, getProvider, install, requestInjection, requestStaticInjection, requireBinding, requireBinding

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • configure

      protected void configure()
      Specified by:
      configure in class com.google.inject.AbstractModule