Interface Bulkhead

All Superinterfaces:
FtHandler, RuntimeType.Api<BulkheadConfig>

public interface Bulkhead extends FtHandler, RuntimeType.Api<BulkheadConfig>
Bulkhead protects a resource that cannot serve unlimited parallel requests.

When the limit of parallel execution is reached, requests are enqueued until the queue length is reached. Once both the limit and queue are full, additional attempts to invoke will end with a failed response with BulkheadException.

  • Field Details

    • FT_BULKHEAD_CALLS_TOTAL

      static final String FT_BULKHEAD_CALLS_TOTAL
      Counter for all the calls in a bulkhead.
      See Also:
    • FT_BULKHEAD_WAITINGDURATION

      static final String FT_BULKHEAD_WAITINGDURATION
      Histogram of waiting time to enter a bulkhead.
      See Also:
    • FT_BULKHEAD_EXECUTIONSRUNNING

      static final String FT_BULKHEAD_EXECUTIONSRUNNING
      Gauge of number of executions running at a certain time.
      See Also:
    • FT_BULKHEAD_EXECUTIONSWAITING

      static final String FT_BULKHEAD_EXECUTIONSWAITING
      Gauge of number of executions waiting at a certain time.
      See Also:
    • FT_BULKHEAD_EXECUTIONSREJECTED

      static final String FT_BULKHEAD_EXECUTIONSREJECTED
      Gauge of number of executions rejected by the bulkhead.
      See Also:
  • Method Details

    • create

      static Bulkhead create(BulkheadConfig config)
      Create Bulkhead from its configuration.
      Parameters:
      config - configuration of a bulkhead to create
      Returns:
      a new bulkhead
    • create

      static Bulkhead create(Consumer<BulkheadConfig.Builder> builderConsumer)
      Create Bulkhead customizing its configuration.
      Parameters:
      builderConsumer - consumer to update configuration of bulkhead
      Returns:
      a new bulkhead
    • builder

      static BulkheadConfig.Builder builder()
      Create a new bulkhead fluent API builder.
      Returns:
      a new bulkhead builder
    • stats

      Provides access to internal stats for this bulkhead.
      Returns:
      internal stats.
    • cancelSupplier

      boolean cancelSupplier(Supplier<?> supplier)
      Can be used to cancel a supplier while queued.
      Parameters:
      supplier - the supplier
      Returns:
      outcome of cancellation