Interface Fallback.Builder

All Superinterfaces:
Buildable, CopyableBuilder<Fallback.Builder,Fallback>, SdkBuilder<Fallback.Builder,Fallback>, SdkPojo
Enclosing class:
Fallback

@Mutable @NotThreadSafe public static interface Fallback.Builder extends SdkPojo, CopyableBuilder<Fallback.Builder,Fallback>
  • Method Details

    • triggerOn

      Fallback.Builder triggerOn(FallbackTriggers triggerOn)

      The status codes and errors from the route's target that cause the gateway to send the request to the first fallback target. If you omit triggerOn, the gateway falls back on 5XX status codes and on the CONNECTION_ERROR, FIRST_BYTE_TIMEOUT, and UNROUTABLE errors. If you specify triggerOn, only the status codes and errors that you list trigger a fallback.

      Parameters:
      triggerOn - The status codes and errors from the route's target that cause the gateway to send the request to the first fallback target. If you omit triggerOn, the gateway falls back on 5XX status codes and on the CONNECTION_ERROR, FIRST_BYTE_TIMEOUT, and UNROUTABLE errors. If you specify triggerOn, only the status codes and errors that you list trigger a fallback.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • triggerOn

      default Fallback.Builder triggerOn(Consumer<FallbackTriggers.Builder> triggerOn)

      The status codes and errors from the route's target that cause the gateway to send the request to the first fallback target. If you omit triggerOn, the gateway falls back on 5XX status codes and on the CONNECTION_ERROR, FIRST_BYTE_TIMEOUT, and UNROUTABLE errors. If you specify triggerOn, only the status codes and errors that you list trigger a fallback.

      This is a convenience method that creates an instance of the FallbackTriggers.Builder avoiding the need to create one manually via FallbackTriggers.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to triggerOn(FallbackTriggers).

      Parameters:
      triggerOn - a consumer that will call methods on FallbackTriggers.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • firstByteTimeoutMilliseconds

      Fallback.Builder firstByteTimeoutMilliseconds(Integer firstByteTimeoutMilliseconds)

      The maximum time, in milliseconds, from sending the request to the route's target until the first byte of the response body arrives. If the time expires, the gateway abandons the request and treats it as a FIRST_BYTE_TIMEOUT error. If you don't specify a value, no timeout is enforced.

      Parameters:
      firstByteTimeoutMilliseconds - The maximum time, in milliseconds, from sending the request to the route's target until the first byte of the response body arrives. If the time expires, the gateway abandons the request and treats it as a FIRST_BYTE_TIMEOUT error. If you don't specify a value, no timeout is enforced.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • circuitBreaker

      Fallback.Builder circuitBreaker(CircuitBreakerConfiguration circuitBreaker)

      Specifies whether the gateway temporarily stops sending your requests to a failing target. The circuit breaker tracks each combination of target and model separately. With the circuit breaker enabled, the gateway skips one or more targets and models that fail repeatedly, and your requests go to the next target in the chain. The gateway always tries the last remaining target in the chain. The gateway enables the circuit breaker by default.

      Parameters:
      circuitBreaker - Specifies whether the gateway temporarily stops sending your requests to a failing target. The circuit breaker tracks each combination of target and model separately. With the circuit breaker enabled, the gateway skips one or more targets and models that fail repeatedly, and your requests go to the next target in the chain. The gateway always tries the last remaining target in the chain. The gateway enables the circuit breaker by default.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • circuitBreaker

      default Fallback.Builder circuitBreaker(Consumer<CircuitBreakerConfiguration.Builder> circuitBreaker)

      Specifies whether the gateway temporarily stops sending your requests to a failing target. The circuit breaker tracks each combination of target and model separately. With the circuit breaker enabled, the gateway skips one or more targets and models that fail repeatedly, and your requests go to the next target in the chain. The gateway always tries the last remaining target in the chain. The gateway enables the circuit breaker by default.

      This is a convenience method that creates an instance of the CircuitBreakerConfiguration.Builder avoiding the need to create one manually via CircuitBreakerConfiguration.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to circuitBreaker(CircuitBreakerConfiguration).

      Parameters:
      circuitBreaker - a consumer that will call methods on CircuitBreakerConfiguration.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • targetFallback

      Fallback.Builder targetFallback(Collection<FallbackTarget> targetFallback)

      The ordered list of fallback targets. The gateway tries each target in order until a response doesn't match that target's triggers, and returns that response to the caller. If every target fails, the gateway returns the last response. You can specify up to two fallback targets. Each combination of target and model, including the route's target, can appear only once.

      Parameters:
      targetFallback - The ordered list of fallback targets. The gateway tries each target in order until a response doesn't match that target's triggers, and returns that response to the caller. If every target fails, the gateway returns the last response. You can specify up to two fallback targets. Each combination of target and model, including the route's target, can appear only once.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • targetFallback

      Fallback.Builder targetFallback(FallbackTarget... targetFallback)

      The ordered list of fallback targets. The gateway tries each target in order until a response doesn't match that target's triggers, and returns that response to the caller. If every target fails, the gateway returns the last response. You can specify up to two fallback targets. Each combination of target and model, including the route's target, can appear only once.

      Parameters:
      targetFallback - The ordered list of fallback targets. The gateway tries each target in order until a response doesn't match that target's triggers, and returns that response to the caller. If every target fails, the gateway returns the last response. You can specify up to two fallback targets. Each combination of target and model, including the route's target, can appear only once.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • targetFallback

      Fallback.Builder targetFallback(Consumer<FallbackTarget.Builder>... targetFallback)

      The ordered list of fallback targets. The gateway tries each target in order until a response doesn't match that target's triggers, and returns that response to the caller. If every target fails, the gateway returns the last response. You can specify up to two fallback targets. Each combination of target and model, including the route's target, can appear only once.

      This is a convenience method that creates an instance of the FallbackTarget.Builder avoiding the need to create one manually via FallbackTarget.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to targetFallback(List<FallbackTarget>).

      Parameters:
      targetFallback - a consumer that will call methods on FallbackTarget.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also: