Commit 60d3d1cc authored by Ronak Sakhuja's avatar Ronak Sakhuja
Browse files

fixed imports

parent 10566f42
Pipeline #55254 failed with stages
in 6 minutes and 37 seconds
...@@ -15,12 +15,15 @@ ...@@ -15,12 +15,15 @@
package org.opengroup.osdu.azure.resiliency; package org.opengroup.osdu.azure.resiliency;
import io.github.resilience4j.circuitbreaker.CircuitBreakerConfig;
import io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry; import io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import java.time.Duration;
/** /**
* Configuration for CircuitBreaker. * Configuration for CircuitBreaker.
*/ */
...@@ -34,7 +37,7 @@ public class AzureCircuitBreakerConfiguration { ...@@ -34,7 +37,7 @@ public class AzureCircuitBreakerConfiguration {
* Constructor which initializes CircuitBreakerRegistry. * Constructor which initializes CircuitBreakerRegistry.
*/ */
public AzureCircuitBreakerConfiguration() { public AzureCircuitBreakerConfiguration() {
this.circuitBreakerRegistry = this.createCBR(); this.setCBR();
} }
private boolean enable = false; private boolean enable = false;
...@@ -44,24 +47,21 @@ public class AzureCircuitBreakerConfiguration { ...@@ -44,24 +47,21 @@ public class AzureCircuitBreakerConfiguration {
/** /**
* Create CircuitBreakerRegistry. * Create CircuitBreakerRegistry.
* @return newly created CircuitBreakerRegistry.
*/ */
private CircuitBreakerRegistry createCBR() { private void setCBR() {
// TODO : THIS CHANGE IS ONLY FOR TESTING PURPOSE ON DEV // TODO : THIS CHANGE IS ONLY FOR TESTING PURPOSE ON DEV
CircuitBreakerConfig circuitBreakerConfig = CircuitBreakerConfig.custom() CircuitBreakerConfig circuitBreakerConfig = CircuitBreakerConfig.custom()
.failureRateThreshold(50) .failureRateThreshold(50)
.waitDurationInOpenState(Duration.ofMillis(10000)) .waitDurationInOpenState(Duration.ofMillis(10000))
.permittedNumberOfCallsInHalfOpenState(5) .permittedNumberOfCallsInHalfOpenState(5)
.slidingWindowSize(5) .slidingWindowSize(5)
.minimumNumberOfCalls(5) .minimumNumberOfCalls(5)
.build(); .build();
// Create a CircuitBreakerRegistry with a custom global configuration // Create a CircuitBreakerRegistry with a custom global configuration
CircuitBreakerRegistry circuitBreakerRegistry = this.circuitBreakerRegistry = CircuitBreakerRegistry.of(circuitBreakerConfig);
CircuitBreakerRegistry.of(circuitBreakerConfig);
// circuitBreakerRegistry = // circuitBreakerRegistry =
// CircuitBreakerRegistry.ofDefaults(); // CircuitBreakerRegistry.ofDefaults();
// return circuitBreakerRegistry; // return circuitBreakerRegistry;
return circuitBreakerRegistry;
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment