Java Code Examples for io.github.resilience4j.bulkhead.BulkheadConfig#ofDefaults()

The following examples show how to use io.github.resilience4j.bulkhead.BulkheadConfig#ofDefaults() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SemaphoreBulkheadTest.java    From resilience4j with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldCreateBulkheadRegistryWithRegistryStore() {
    RegistryEventConsumer<Bulkhead> registryEventConsumer = getNoOpsRegistryEventConsumer();
    List<RegistryEventConsumer<Bulkhead>> registryEventConsumers = new ArrayList<>();
    registryEventConsumers.add(registryEventConsumer);
    Map<String, BulkheadConfig> configs = new HashMap<>();
    final BulkheadConfig defaultConfig = BulkheadConfig.ofDefaults();
    configs.put("default", defaultConfig);
    final InMemoryBulkheadRegistry inMemoryBulkheadRegistry =
        new InMemoryBulkheadRegistry(configs, registryEventConsumers,
            io.vavr.collection.HashMap.of("Tag1", "Tag1Value"), new InMemoryRegistryStore());

    AssertionsForClassTypes.assertThat(inMemoryBulkheadRegistry).isNotNull();
    AssertionsForClassTypes.assertThat(inMemoryBulkheadRegistry.getDefaultConfig()).isEqualTo(defaultConfig);
    AssertionsForClassTypes.assertThat(inMemoryBulkheadRegistry.getConfiguration("testNotFound")).isEmpty();
    inMemoryBulkheadRegistry.addConfiguration("testConfig", defaultConfig);
    AssertionsForClassTypes.assertThat(inMemoryBulkheadRegistry.getConfiguration("testConfig")).isNotNull();
}
 
Example 2
Source File: InMemoryBulkheadRegistry.java    From resilience4j with Apache License 2.0 4 votes vote down vote up
/**
 * The constructor with default default.
 */
public InMemoryBulkheadRegistry() {
    this(BulkheadConfig.ofDefaults());
}
 
Example 3
Source File: InMemoryBulkheadRegistry.java    From resilience4j with Apache License 2.0 4 votes vote down vote up
public InMemoryBulkheadRegistry(io.vavr.collection.Map<String, String> tags) {
    this(BulkheadConfig.ofDefaults(), tags);
}
 
Example 4
Source File: SemaphoreBulkhead.java    From resilience4j with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a bulkhead with a default config.
 *
 * @param name the name of this bulkhead
 */
public SemaphoreBulkhead(String name) {
    this(name, BulkheadConfig.ofDefaults(), HashMap.empty());
}