Class CircuitBreakerTransformer<T>

java.lang.Object
io.github.resilience4j.ratpack.internal.AbstractTransformer<T>
io.github.resilience4j.ratpack.circuitbreaker.CircuitBreakerTransformer<T>
All Implemented Interfaces:
ratpack.func.Function<ratpack.exec.Upstream<? extends T>,​ratpack.exec.Upstream<T>>

public class CircuitBreakerTransformer<T>
extends AbstractTransformer<T>
  • Nested Class Summary

    Nested classes/interfaces inherited from interface ratpack.func.Function

    ratpack.func.Function.ConditionalSpec<I extends java.lang.Object,​O extends java.lang.Object>
  • Field Summary

    Fields inherited from class io.github.resilience4j.ratpack.internal.AbstractTransformer

    recoverer
  • Method Summary

    Modifier and Type Method Description
    ratpack.exec.Upstream<T> apply​(ratpack.exec.Upstream<? extends T> upstream)  
    static <T> CircuitBreakerTransformer<T> of​(io.github.resilience4j.circuitbreaker.CircuitBreaker circuitBreaker)
    Create a new transformer that can be applied to the Promise.transform(Function) method.
    CircuitBreakerTransformer<T> recover​(ratpack.func.Function<java.lang.Throwable,​? extends T> recoverer)
    Set a recovery function that will execute when the circuit breaker is open.

    Methods inherited from class io.github.resilience4j.ratpack.internal.AbstractTransformer

    handleRecovery

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface ratpack.func.Function

    andThen, compose, toFunction, toGuavaFunction
  • Method Details

    • of

      public static <T> CircuitBreakerTransformer<T> of​(io.github.resilience4j.circuitbreaker.CircuitBreaker circuitBreaker)
      Create a new transformer that can be applied to the Promise.transform(Function) method. The Promised value will pass through the circuitbreaker, potentially causing it to open if the thresholds for the circuit breaker are exceeded.
      Type Parameters:
      T - the type of object
      Parameters:
      circuitBreaker - the circuit breaker to use
      Returns:
      the transformer
    • recover

      public CircuitBreakerTransformer<T> recover​(ratpack.func.Function<java.lang.Throwable,​? extends T> recoverer)
      Set a recovery function that will execute when the circuit breaker is open.
      Parameters:
      recoverer - the recovery function
      Returns:
      the transformer
    • apply

      public ratpack.exec.Upstream<T> apply​(ratpack.exec.Upstream<? extends T> upstream) throws java.lang.Exception
      Throws:
      java.lang.Exception