For the latest stable version, please use Spring-Cloud-CircuitBreaker 3.2.0!

Bulkhead Properties Configuration

You can configure ThreadPoolBulkhead and SemaphoreBulkhead instances in your application’s configuration properties file. Property configuration has higher priority than Java Customizer configuration.

resilience4j.thread-pool-bulkhead:
    instances:
        backendA:
            maxThreadPoolSize: 1
            coreThreadPoolSize: 1
resilience4j.bulkhead:
    instances:
        backendB:
            maxConcurrentCalls: 10

You can also provide common configuration via resilience4j.bulkhead.configs. and resilience4j.thread-pool-bulkhead.configs. properties. This allows you to specify configuration once and reuse it across multiple bulkheads.

resilience4j.bulkhead:
    configs:
        default:
            queueCapacity: 5
        someShared:
            queueCapacity: 10
    instances:
        backendA:
            baseConfig: default
            maxConcurrentCalls: 10
        backendB:
            baseConfig: someShared

If you configure your bulkhead this way it will take lowest priority. The priority order is:

  1. resilience4j.thread-pool-bulkhead.instances. or resilience4j.bulkhead.instances.

  2. Customizer configuration using Resilience4JBulkheadProvider.

  3. resilience4j.thread-pool-bulkhead.configs. or resilience4j.bulkhead.configs.

For more information on the Resilience4j property configuration, see Resilience4J Spring Boot 2 Configuration.