Annotation Interface CircuitBreaker


Variation of Retryable that implements the Circuit Breaker pattern. Has higher overhead than Retryable as a CircuitState has to be maintained for each method call
Since:
1.0
  • Field Details

  • Element Details

    • includes

      @AliasFor(annotation=Retryable.class, member="includes") Class<? extends Throwable>[] includes
      Returns:
      The exception types to include (defaults to all)
      Default:
      {}
    • excludes

      @AliasFor(annotation=Retryable.class, member="excludes") Class<? extends Throwable>[] excludes
      Returns:
      The exception types to exclude (defaults to none)
      Default:
      {}
    • attempts

      @Digits(integer=4, fraction=0) @AliasFor(annotation=Retryable.class, member="attempts") @Digits(integer=4,fraction=0) String attempts
      Returns:
      The maximum number of retry attempts
      Default:
      "3"
    • delay

      @AliasFor(annotation=Retryable.class, member="delay") String delay
      Returns:
      The delay between retry attempts
      Default:
      "500ms"
    • multiplier

      @Digits(integer=2, fraction=2) @AliasFor(annotation=Retryable.class, member="multiplier") @Digits(integer=2,fraction=2) String multiplier
      Returns:
      The multiplier to use to calculate the delay between retries.
      Default:
      "0"
    • maxDelay

      @AliasFor(annotation=Retryable.class, member="maxDelay") String maxDelay
      The maximum overall delay for an operation to complete until the Circuit state is set to CircuitState.OPEN.
      Returns:
      The maximum overall delay
      Default:
      "5s"
    • reset

      String reset
      Sets the Duration of time before resetting the circuit to CircuitState.HALF_OPEN allowing a single retry.
      Returns:
      The Duration of time before reset
      Default:
      "20s"
    • predicate

      @AliasFor(annotation=Retryable.class, member="predicate") Class<? extends RetryPredicate> predicate
      Returns:
      The retry predicate class to use instead of Retryable.includes() and Retryable.excludes() (defaults to none)
      Default:
      io.micronaut.retry.annotation.DefaultRetryPredicate.class
    • throwWrappedException

      boolean throwWrappedException
      If true and the circuit is opened, it throws the original exception wrapped. in a CircuitOpenException
      Returns:
      Whether to wrap the original exception in a CircuitOpenException
      Default:
      false