io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry Java Examples
The following examples show how to use
io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry.
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: CircuitBreakerMetricsPublisherTest.java From resilience4j with Apache License 2.0 | 6 votes |
@Before public void setup() { registry = new CollectorRegistry(); circuitBreakerMetricsPublisher = new CircuitBreakerMetricsPublisher(); circuitBreakerMetricsPublisher.register(registry); circuitBreakerRegistry = CircuitBreakerRegistry .of(CircuitBreakerConfig.ofDefaults(), circuitBreakerMetricsPublisher); CircuitBreakerConfig configWithSlowCallThreshold = CircuitBreakerConfig.custom() .slowCallDurationThreshold(Duration.ofSeconds(1)).build(); circuitBreaker = circuitBreakerRegistry .circuitBreaker("backendA", configWithSlowCallThreshold); // record some basic stats // SLOW_SUCCESS circuitBreaker.onSuccess(2000, TimeUnit.NANOSECONDS); circuitBreaker.onError(100, TimeUnit.NANOSECONDS, new RuntimeException("oops")); circuitBreaker.transitionToOpenState(); }
Example #2
Source File: DefaultApplicationDAO.java From front50 with Apache License 2.0 | 6 votes |
public DefaultApplicationDAO( StorageService service, Scheduler scheduler, ObjectKeyLoader objectKeyLoader, long refreshIntervalMs, boolean shouldWarmCache, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { super( ObjectType.APPLICATION, service, scheduler, objectKeyLoader, refreshIntervalMs, shouldWarmCache, registry, circuitBreakerRegistry); }
Example #3
Source File: CommonStorageServiceDAOConfig.java From front50 with Apache License 2.0 | 6 votes |
@Bean ProjectDAO projectDAO( StorageService storageService, StorageServiceConfigurationProperties storageServiceConfigurationProperties, ObjectKeyLoader objectKeyLoader, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { return new DefaultProjectDAO( storageService, Schedulers.from( Executors.newFixedThreadPool( storageServiceConfigurationProperties.getProject().getThreadPool())), objectKeyLoader, storageServiceConfigurationProperties.getProject().getRefreshMs(), storageServiceConfigurationProperties.getProject().getShouldWarmCache(), registry, circuitBreakerRegistry); }
Example #4
Source File: CommonStorageServiceDAOConfig.java From front50 with Apache License 2.0 | 6 votes |
@Bean ServiceAccountDAO serviceAccountDAO( StorageService storageService, StorageServiceConfigurationProperties storageServiceConfigurationProperties, ObjectKeyLoader objectKeyLoader, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { return new DefaultServiceAccountDAO( storageService, Schedulers.from( Executors.newFixedThreadPool( storageServiceConfigurationProperties.getServiceAccount().getThreadPool())), objectKeyLoader, storageServiceConfigurationProperties.getServiceAccount().getRefreshMs(), storageServiceConfigurationProperties.getServiceAccount().getShouldWarmCache(), registry, circuitBreakerRegistry); }
Example #5
Source File: DefaultPipelineStrategyDAO.java From front50 with Apache License 2.0 | 6 votes |
public DefaultPipelineStrategyDAO( StorageService service, Scheduler scheduler, ObjectKeyLoader objectKeyLoader, long refreshIntervalMs, boolean shouldWarmCache, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { super( ObjectType.STRATEGY, service, scheduler, objectKeyLoader, refreshIntervalMs, shouldWarmCache, registry, circuitBreakerRegistry); }
Example #6
Source File: StateTransitionMetricsTest.java From resilience4j with Apache License 2.0 | 6 votes |
@Test public void testWithCircuitBreakerMetricsPublisher() throws Exception { CircuitBreakerConfig config = CircuitBreakerConfig.custom() .waitDurationInOpenState(Duration.ofSeconds(1)) .failureRateThreshold(50) .permittedNumberOfCallsInHalfOpenState(3) .slidingWindowSize(10) .build(); MetricRegistry metricRegistry = new MetricRegistry(); CircuitBreakerRegistry circuitBreakerRegistry = CircuitBreakerRegistry .of(config, new CircuitBreakerMetricsPublisher(metricRegistry)); CircuitBreaker circuitBreaker = circuitBreakerRegistry.circuitBreaker("test", config); circuitBreakerMetricsUsesFirstStateObjectInstance(circuitBreaker, metricRegistry); }
Example #7
Source File: CommonStorageServiceDAOConfig.java From front50 with Apache License 2.0 | 6 votes |
@Bean PluginInfoRepository pluginInfoRepository( StorageService storageService, StorageServiceConfigurationProperties storageServiceConfigurationProperties, ObjectKeyLoader objectKeyLoader, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { return new DefaultPluginInfoRepository( storageService, Schedulers.from( Executors.newFixedThreadPool( storageServiceConfigurationProperties.getPluginInfo().getThreadPool())), objectKeyLoader, storageServiceConfigurationProperties.getPluginInfo().getRefreshMs(), storageServiceConfigurationProperties.getPluginInfo().getShouldWarmCache(), registry, circuitBreakerRegistry); }
Example #8
Source File: CommonStorageServiceDAOConfig.java From front50 with Apache License 2.0 | 6 votes |
@Bean DeliveryRepository deliveryRepository( StorageService storageService, StorageServiceConfigurationProperties storageServiceConfigurationProperties, ObjectKeyLoader objectKeyLoader, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { return new DefaultDeliveryRepository( storageService, Schedulers.from( Executors.newFixedThreadPool( storageServiceConfigurationProperties.getDeliveryConfig().getThreadPool())), objectKeyLoader, storageServiceConfigurationProperties.getDeliveryConfig().getRefreshMs(), storageServiceConfigurationProperties.getDeliveryConfig().getShouldWarmCache(), registry, circuitBreakerRegistry); }
Example #9
Source File: DefaultNotificationDAO.java From front50 with Apache License 2.0 | 6 votes |
public DefaultNotificationDAO( StorageService service, Scheduler scheduler, ObjectKeyLoader objectKeyLoader, long refreshIntervalMs, boolean shouldWarmCache, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { super( ObjectType.NOTIFICATION, service, scheduler, objectKeyLoader, refreshIntervalMs, shouldWarmCache, registry, circuitBreakerRegistry); }
Example #10
Source File: DefaultProjectDAO.java From front50 with Apache License 2.0 | 6 votes |
public DefaultProjectDAO( StorageService service, Scheduler scheduler, ObjectKeyLoader objectKeyLoader, long refreshIntervalMs, boolean shouldWarmCache, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { super( ObjectType.PROJECT, service, scheduler, objectKeyLoader, refreshIntervalMs, shouldWarmCache, registry, circuitBreakerRegistry); }
Example #11
Source File: DefaultPipelineTemplateDAO.java From front50 with Apache License 2.0 | 6 votes |
public DefaultPipelineTemplateDAO( StorageService service, Scheduler scheduler, ObjectKeyLoader objectKeyLoader, long refreshIntervalMs, boolean shouldWarmCache, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { super( ObjectType.PIPELINE_TEMPLATE, service, scheduler, objectKeyLoader, refreshIntervalMs, shouldWarmCache, registry, circuitBreakerRegistry); }
Example #12
Source File: DefaultPluginInfoRepository.java From front50 with Apache License 2.0 | 6 votes |
public DefaultPluginInfoRepository( StorageService service, Scheduler scheduler, ObjectKeyLoader objectKeyLoader, long refreshIntervalMs, boolean shouldWarmCache, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { super( ObjectType.PLUGIN_INFO, service, scheduler, objectKeyLoader, refreshIntervalMs, shouldWarmCache, registry, circuitBreakerRegistry); }
Example #13
Source File: GcsConfig.java From front50 with Apache License 2.0 | 6 votes |
@Override public ApplicationPermissionDAO applicationPermissionDAO( StorageService storageService, StorageServiceConfigurationProperties storageServiceConfigurationProperties, ObjectKeyLoader objectKeyLoader, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { GcsStorageService service = googleCloudStorageService(ApplicationPermissionDAO.DEFAULT_DATA_FILENAME, gcsProperties); ObjectKeyLoader keyLoader = new DefaultObjectKeyLoader(service); return new DefaultApplicationPermissionDAO( service, Schedulers.from( Executors.newFixedThreadPool( storageServiceConfigurationProperties.getApplicationPermission().getThreadPool())), keyLoader, storageServiceConfigurationProperties.getApplicationPermission().getRefreshMs(), storageServiceConfigurationProperties.getApplicationPermission().getShouldWarmCache(), registry, circuitBreakerRegistry); }
Example #14
Source File: StateTransitionMetricsTest.java From resilience4j with Apache License 2.0 | 6 votes |
@Test public void testWithCircuitBreakerMetrics() throws Exception { CircuitBreakerConfig config = CircuitBreakerConfig.custom() .waitDurationInOpenState(Duration.ofMillis(150)) .failureRateThreshold(50) .permittedNumberOfCallsInHalfOpenState(3) .slidingWindowSize(10) .build(); CircuitBreaker circuitBreaker = CircuitBreakerRegistry.ofDefaults() .circuitBreaker("test", config); MetricRegistry metricRegistry = new MetricRegistry(); metricRegistry.registerAll(CircuitBreakerMetrics.ofCircuitBreaker(circuitBreaker)); circuitBreakerMetricsUsesFirstStateObjectInstance(circuitBreaker, metricRegistry); }
Example #15
Source File: CommonStorageServiceDAOConfig.java From front50 with Apache License 2.0 | 6 votes |
@Bean PipelineDAO pipelineDAO( StorageService storageService, StorageServiceConfigurationProperties storageServiceConfigurationProperties, ObjectKeyLoader objectKeyLoader, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { return new DefaultPipelineDAO( storageService, Schedulers.from( Executors.newFixedThreadPool( storageServiceConfigurationProperties.getPipeline().getThreadPool())), objectKeyLoader, storageServiceConfigurationProperties.getPipeline().getRefreshMs(), storageServiceConfigurationProperties.getPipeline().getShouldWarmCache(), registry, circuitBreakerRegistry); }
Example #16
Source File: DefaultApplicationPermissionDAO.java From front50 with Apache License 2.0 | 6 votes |
public DefaultApplicationPermissionDAO( StorageService service, Scheduler scheduler, ObjectKeyLoader objectKeyLoader, long refreshIntervalMs, boolean shouldWarmCache, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { super( ObjectType.APPLICATION_PERMISSION, service, scheduler, objectKeyLoader, refreshIntervalMs, shouldWarmCache, registry, circuitBreakerRegistry); }
Example #17
Source File: CircuitBreakerMetricsCollectorTest.java From resilience4j with Apache License 2.0 | 6 votes |
@Before public void setup() { registry = new CollectorRegistry(); circuitBreakerRegistry = CircuitBreakerRegistry.ofDefaults(); CircuitBreakerConfig configWithSlowCallThreshold = CircuitBreakerConfig.custom() .slowCallDurationThreshold(Duration.ofSeconds(1)).build(); circuitBreaker = circuitBreakerRegistry .circuitBreaker("backendA", configWithSlowCallThreshold); CircuitBreakerMetricsCollector.ofCircuitBreakerRegistry(circuitBreakerRegistry) .register(registry); // record some basic stats // SLOW_SUCCESS circuitBreaker.onSuccess(2000, TimeUnit.NANOSECONDS); circuitBreaker.onError(100, TimeUnit.NANOSECONDS, new RuntimeException("oops")); circuitBreaker.transitionToOpenState(); }
Example #18
Source File: CommonStorageServiceDAOConfig.java From front50 with Apache License 2.0 | 6 votes |
@Bean NotificationDAO notificationDAO( StorageService storageService, StorageServiceConfigurationProperties storageServiceConfigurationProperties, ObjectKeyLoader objectKeyLoader, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { return new DefaultNotificationDAO( storageService, Schedulers.from( Executors.newFixedThreadPool( storageServiceConfigurationProperties.getNotification().getThreadPool())), objectKeyLoader, storageServiceConfigurationProperties.getNotification().getRefreshMs(), storageServiceConfigurationProperties.getNotification().getShouldWarmCache(), registry, circuitBreakerRegistry); }
Example #19
Source File: DefaultEntityTagsDAO.java From front50 with Apache License 2.0 | 6 votes |
public DefaultEntityTagsDAO( StorageService service, Scheduler scheduler, ObjectKeyLoader objectKeyLoader, long refreshIntervalMs, boolean shouldWarmCache, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { super( ObjectType.ENTITY_TAGS, service, scheduler, objectKeyLoader, refreshIntervalMs, shouldWarmCache, registry, circuitBreakerRegistry); }
Example #20
Source File: CommonStorageServiceDAOConfig.java From front50 with Apache License 2.0 | 6 votes |
@Bean PipelineStrategyDAO pipelineStrategyDAO( StorageService storageService, StorageServiceConfigurationProperties storageServiceConfigurationProperties, ObjectKeyLoader objectKeyLoader, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { return new DefaultPipelineStrategyDAO( storageService, Schedulers.from( Executors.newFixedThreadPool( storageServiceConfigurationProperties.getPipelineStrategy().getThreadPool())), objectKeyLoader, storageServiceConfigurationProperties.getPipelineStrategy().getRefreshMs(), storageServiceConfigurationProperties.getPipelineStrategy().getShouldWarmCache(), registry, circuitBreakerRegistry); }
Example #21
Source File: DefaultPluginVersionPinningRepository.java From front50 with Apache License 2.0 | 6 votes |
public DefaultPluginVersionPinningRepository( StorageService service, Scheduler scheduler, ObjectKeyLoader objectKeyLoader, long refreshIntervalMs, boolean shouldWarmCache, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { super( ObjectType.PLUGIN_VERSIONS, service, scheduler, objectKeyLoader, refreshIntervalMs, shouldWarmCache, registry, circuitBreakerRegistry); }
Example #22
Source File: CommonStorageServiceDAOConfig.java From front50 with Apache License 2.0 | 6 votes |
@Bean EntityTagsDAO entityTagsDAO( StorageService storageService, StorageServiceConfigurationProperties storageServiceConfigurationProperties, ObjectKeyLoader objectKeyLoader, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { return new DefaultEntityTagsDAO( storageService, Schedulers.from( Executors.newFixedThreadPool( storageServiceConfigurationProperties.getEntityTags().getThreadPool())), objectKeyLoader, storageServiceConfigurationProperties.getEntityTags().getRefreshMs(), storageServiceConfigurationProperties.getEntityTags().getShouldWarmCache(), registry, circuitBreakerRegistry); }
Example #23
Source File: CommonStorageServiceDAOConfig.java From front50 with Apache License 2.0 | 6 votes |
@Bean PipelineTemplateDAO pipelineTemplateDAO( StorageService storageService, StorageServiceConfigurationProperties storageServiceConfigurationProperties, ObjectKeyLoader objectKeyLoader, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { return new DefaultPipelineTemplateDAO( storageService, Schedulers.from( Executors.newFixedThreadPool( storageServiceConfigurationProperties.getPipelineTemplate().getThreadPool())), objectKeyLoader, storageServiceConfigurationProperties.getPipelineTemplate().getRefreshMs(), storageServiceConfigurationProperties.getPipelineTemplate().getShouldWarmCache(), registry, circuitBreakerRegistry); }
Example #24
Source File: DefaultSnapshotDAO.java From front50 with Apache License 2.0 | 6 votes |
public DefaultSnapshotDAO( StorageService service, Scheduler scheduler, ObjectKeyLoader objectKeyLoader, long refreshIntervalMs, boolean shouldWarmCache, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { super( ObjectType.SNAPSHOT, service, scheduler, objectKeyLoader, refreshIntervalMs, shouldWarmCache, registry, circuitBreakerRegistry); }
Example #25
Source File: CommonStorageServiceDAOConfig.java From front50 with Apache License 2.0 | 6 votes |
@Bean ApplicationPermissionDAO applicationPermissionDAO( StorageService storageService, StorageServiceConfigurationProperties storageServiceConfigurationProperties, ObjectKeyLoader objectKeyLoader, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { return new DefaultApplicationPermissionDAO( storageService, Schedulers.from( Executors.newFixedThreadPool( storageServiceConfigurationProperties.getApplicationPermission().getThreadPool())), objectKeyLoader, storageServiceConfigurationProperties.getApplicationPermission().getRefreshMs(), storageServiceConfigurationProperties.getApplicationPermission().getShouldWarmCache(), registry, circuitBreakerRegistry); }
Example #26
Source File: TaggedCircuitBreakerMetricsPublisherTest.java From resilience4j with Apache License 2.0 | 6 votes |
@Before public void setUp() { meterRegistry = new SimpleMeterRegistry(); taggedCircuitBreakerMetricsPublisher = new TaggedCircuitBreakerMetricsPublisher(meterRegistry); circuitBreakerRegistry = CircuitBreakerRegistry .of(CircuitBreakerConfig.ofDefaults(), taggedCircuitBreakerMetricsPublisher); CircuitBreakerConfig configWithSlowCallThreshold = CircuitBreakerConfig.custom() .slowCallDurationThreshold(Duration.ofSeconds(1)).build(); circuitBreaker = circuitBreakerRegistry .circuitBreaker("backendA", configWithSlowCallThreshold); // record some basic stats circuitBreaker.onSuccess(0, TimeUnit.NANOSECONDS); circuitBreaker.onError(0, TimeUnit.NANOSECONDS, new RuntimeException("oops")); // record slow call circuitBreaker.onSuccess(2000, TimeUnit.NANOSECONDS); circuitBreaker.onError(2000, TimeUnit.NANOSECONDS, new RuntimeException("oops")); }
Example #27
Source File: CommonStorageServiceDAOConfig.java From front50 with Apache License 2.0 | 6 votes |
@Bean PluginVersionPinningRepository pluginVersionPinningRepository( StorageService storageService, StorageServiceConfigurationProperties storageServiceConfigurationProperties, ObjectKeyLoader objectKeyLoader, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { return new DefaultPluginVersionPinningRepository( storageService, Schedulers.from( Executors.newFixedThreadPool( storageServiceConfigurationProperties.getPluginInfo().getThreadPool())), objectKeyLoader, storageServiceConfigurationProperties.getPluginInfo().getRefreshMs(), storageServiceConfigurationProperties.getPluginInfo().getShouldWarmCache(), registry, circuitBreakerRegistry); }
Example #28
Source File: TaggedCircuitBreakerMetricsTest.java From resilience4j with Apache License 2.0 | 6 votes |
@Before public void setUp() { meterRegistry = new SimpleMeterRegistry(); circuitBreakerRegistry = CircuitBreakerRegistry.ofDefaults(); CircuitBreakerConfig configWithSlowCallThreshold = CircuitBreakerConfig.custom() .slowCallDurationThreshold(Duration.ofSeconds(1)).build(); circuitBreaker = circuitBreakerRegistry .circuitBreaker("backendA", configWithSlowCallThreshold); // record some basic stats circuitBreaker.onSuccess(0, TimeUnit.NANOSECONDS); circuitBreaker.onError(0, TimeUnit.NANOSECONDS, new RuntimeException("oops")); // record slow calls circuitBreaker.onSuccess(2000, TimeUnit.NANOSECONDS); circuitBreaker.onError(2000, TimeUnit.NANOSECONDS, new RuntimeException("oops")); taggedCircuitBreakerMetrics = TaggedCircuitBreakerMetrics .ofCircuitBreakerRegistry(circuitBreakerRegistry); taggedCircuitBreakerMetrics.bindTo(meterRegistry); }
Example #29
Source File: DefaultPipelineDAO.java From front50 with Apache License 2.0 | 6 votes |
public DefaultPipelineDAO( StorageService service, Scheduler scheduler, ObjectKeyLoader objectKeyLoader, long refreshIntervalMs, boolean shouldWarmCache, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { super( ObjectType.PIPELINE, service, scheduler, objectKeyLoader, refreshIntervalMs, shouldWarmCache, registry, circuitBreakerRegistry); }
Example #30
Source File: DefaultDeliveryRepository.java From front50 with Apache License 2.0 | 6 votes |
public DefaultDeliveryRepository( StorageService service, Scheduler scheduler, ObjectKeyLoader objectKeyLoader, long refreshIntervalMs, boolean shouldWarmCache, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry) { super( ObjectType.DELIVERY, service, scheduler, objectKeyLoader, refreshIntervalMs, shouldWarmCache, registry, circuitBreakerRegistry); }