Skip to content

Commit

Permalink
Add retry policy for RestClient (#841)
Browse files Browse the repository at this point in the history
  • Loading branch information
minhtranq-nashtechglobal committed Aug 15, 2024
1 parent 8d4e725 commit 3c77282
Show file tree
Hide file tree
Showing 15 changed files with 156 additions and 5 deletions.
7 changes: 7 additions & 0 deletions cart/src/main/java/com/yas/cart/config/RetryConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.yas.cart.config;

import org.springframework.retry.annotation.EnableRetry;

@EnableRetry
public class RetryConfig {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.yas.cart.service;

import lombok.extern.slf4j.Slf4j;

@Slf4j
abstract class CircuitBreakFallbackService {

protected void handleBodilessFallback(Throwable throwable) throws Throwable {

Check warning on line 8 in cart/src/main/java/com/yas/cart/service/CircuitBreakFallbackService.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def modifier' has incorrect indentation level 2, expected level should be 4.
handleError(throwable);

Check warning on line 9 in cart/src/main/java/com/yas/cart/service/CircuitBreakFallbackService.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def' child has incorrect indentation level 4, expected level should be 8.
}

Check warning on line 10 in cart/src/main/java/com/yas/cart/service/CircuitBreakFallbackService.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def rcurly' has incorrect indentation level 2, expected level should be 4.

protected Object handleFallback(Throwable throwable) throws Throwable {

Check warning on line 12 in cart/src/main/java/com/yas/cart/service/CircuitBreakFallbackService.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def modifier' has incorrect indentation level 2, expected level should be 4.
handleError(throwable);

Check warning on line 13 in cart/src/main/java/com/yas/cart/service/CircuitBreakFallbackService.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def' child has incorrect indentation level 4, expected level should be 8.
return null;

Check warning on line 14 in cart/src/main/java/com/yas/cart/service/CircuitBreakFallbackService.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def' child has incorrect indentation level 4, expected level should be 8.
}

Check warning on line 15 in cart/src/main/java/com/yas/cart/service/CircuitBreakFallbackService.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def rcurly' has incorrect indentation level 2, expected level should be 4.

private void handleError(Throwable throwable) throws Throwable {

Check warning on line 17 in cart/src/main/java/com/yas/cart/service/CircuitBreakFallbackService.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def modifier' has incorrect indentation level 2, expected level should be 4.
log.error("Circuit breaker records an error. Detail {}", throwable.getMessage());

Check warning on line 18 in cart/src/main/java/com/yas/cart/service/CircuitBreakFallbackService.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def' child has incorrect indentation level 4, expected level should be 8.
throw throwable;

Check warning on line 19 in cart/src/main/java/com/yas/cart/service/CircuitBreakFallbackService.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def' child has incorrect indentation level 4, expected level should be 8.
}

Check warning on line 20 in cart/src/main/java/com/yas/cart/service/CircuitBreakFallbackService.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def rcurly' has incorrect indentation level 2, expected level should be 4.
}
6 changes: 5 additions & 1 deletion cart/src/main/java/com/yas/cart/service/ProductService.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,24 @@

import com.yas.cart.config.ServiceUrlConfig;
import com.yas.cart.viewmodel.ProductThumbnailVm;
import io.github.resilience4j.circuitbreaker.annotation.CircuitBreaker;
import java.net.URI;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestClient;
import org.springframework.web.util.UriComponentsBuilder;

@Service
@RequiredArgsConstructor
public class ProductService {
public class ProductService extends CircuitBreakFallbackService {
private final RestClient restClient;
private final ServiceUrlConfig serviceUrlConfig;

@Retryable(maxAttemptsExpression = "${spring.retry.maxAttempts}")
@CircuitBreaker(name = "cart-circuitbreaker", fallbackMethod = "handleFallback")
public List<ProductThumbnailVm> getProducts(List<Long> ids) {
final URI url = UriComponentsBuilder
.fromHttpUrl(serviceUrlConfig.product())
Expand Down
8 changes: 8 additions & 0 deletions cart/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,11 @@ springdoc.swagger-ui.oauth.use-pkce-with-authorization-code-grant=true
springdoc.swagger-ui.oauth.client-id=swagger-ui
springdoc.oauthflow.authorization-url=http://identity/realms/Yas/protocol/openid-connect/auth
springdoc.oauthflow.token-url=http://identity/realms/Yas/protocol/openid-connect/token

spring.retry.maxAttempts=3

resilience4j.circuitbreaker.instances.cart-circuitbreaker.sliding-window-type=COUNT_BASED
resilience4j.circuitbreaker.instances.cart-circuitbreaker.failure-rate-threshold=50
resilience4j.circuitbreaker.instances.cart-circuitbreaker.minimum-number-of-calls=5
resilience4j.circuitbreaker.instances.cart-circuitbreaker.automatic-transition-from-open-to-half-open-enabled=true
resilience4j.circuitbreaker.instances.cart-circuitbreaker.permitted-number-of-calls-in-half-open-state=3
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.yas.customer.config;

import org.springframework.retry.annotation.EnableRetry;

@EnableRetry
public class RetryConfig {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.yas.customer.service;

import lombok.extern.slf4j.Slf4j;

@Slf4j
abstract class AbstractCircuitBreakFallbackHandler {

protected void handleBodilessFallback(Throwable throwable) throws Throwable {

Check warning on line 8 in customer/src/main/java/com/yas/customer/service/AbstractCircuitBreakFallbackHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def modifier' has incorrect indentation level 2, expected level should be 4.
handleError(throwable);

Check warning on line 9 in customer/src/main/java/com/yas/customer/service/AbstractCircuitBreakFallbackHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def' child has incorrect indentation level 4, expected level should be 8.
}

Check warning on line 10 in customer/src/main/java/com/yas/customer/service/AbstractCircuitBreakFallbackHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def rcurly' has incorrect indentation level 2, expected level should be 4.

protected Object handleFallback(Throwable throwable) throws Throwable {

Check warning on line 12 in customer/src/main/java/com/yas/customer/service/AbstractCircuitBreakFallbackHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def modifier' has incorrect indentation level 2, expected level should be 4.
handleError(throwable);

Check warning on line 13 in customer/src/main/java/com/yas/customer/service/AbstractCircuitBreakFallbackHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def' child has incorrect indentation level 4, expected level should be 8.
return null;

Check warning on line 14 in customer/src/main/java/com/yas/customer/service/AbstractCircuitBreakFallbackHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def' child has incorrect indentation level 4, expected level should be 8.
}

Check warning on line 15 in customer/src/main/java/com/yas/customer/service/AbstractCircuitBreakFallbackHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def rcurly' has incorrect indentation level 2, expected level should be 4.

private void handleError(Throwable throwable) throws Throwable {

Check warning on line 17 in customer/src/main/java/com/yas/customer/service/AbstractCircuitBreakFallbackHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def modifier' has incorrect indentation level 2, expected level should be 4.
log.error("Circuit breaker records an error. Detail {}", throwable.getMessage());

Check warning on line 18 in customer/src/main/java/com/yas/customer/service/AbstractCircuitBreakFallbackHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def' child has incorrect indentation level 4, expected level should be 8.
throw throwable;

Check warning on line 19 in customer/src/main/java/com/yas/customer/service/AbstractCircuitBreakFallbackHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def' child has incorrect indentation level 4, expected level should be 8.
}

Check warning on line 20 in customer/src/main/java/com/yas/customer/service/AbstractCircuitBreakFallbackHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def rcurly' has incorrect indentation level 2, expected level should be 4.
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
import com.yas.customer.viewmodel.address.AddressDetailVm;
import com.yas.customer.viewmodel.address.AddressPostVm;
import com.yas.customer.viewmodel.address.AddressVm;
import io.github.resilience4j.circuitbreaker.annotation.CircuitBreaker;
import java.net.URI;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.retry.annotation.Retryable;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.oauth2.jwt.Jwt;
import org.springframework.stereotype.Service;
Expand All @@ -17,11 +19,13 @@

@Service
@RequiredArgsConstructor
public class LocationService {
public class LocationService extends AbstractCircuitBreakFallbackHandler {

private final RestClient restClient;
private final ServiceUrlConfig serviceUrlConfig;

@Retryable(maxAttemptsExpression = "${spring.retry.maxAttempts}")
@CircuitBreaker(name = "customer-circuitbreaker", fallbackMethod = "handleFallback")
public List<AddressDetailVm> getAddressesByIdList(List<Long> ids) {
final String jwt =
((Jwt) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getTokenValue();
Expand All @@ -40,6 +44,8 @@ public List<AddressDetailVm> getAddressesByIdList(List<Long> ids) {
});
}

@Retryable(maxAttemptsExpression = "${spring.retry.maxAttempts}")
@CircuitBreaker(name = "customer-circuitbreaker", fallbackMethod = "handleFallback")
public AddressDetailVm getAddressById(Long id) {
final String jwt =
((Jwt) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getTokenValue();
Expand All @@ -56,6 +62,8 @@ public AddressDetailVm getAddressById(Long id) {
.body(AddressDetailVm.class);
}

@Retryable(maxAttemptsExpression = "${spring.retry.maxAttempts}")
@CircuitBreaker(name = "customer-circuitbreaker", fallbackMethod = "handleFallback")
public AddressVm createAddress(AddressPostVm addressPostVm) {
final String jwt =
((Jwt) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getTokenValue();
Expand Down
10 changes: 9 additions & 1 deletion customer/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,12 @@ springdoc.packagesToScan=com.yas.customer
springdoc.swagger-ui.oauth.use-pkce-with-authorization-code-grant=true
springdoc.swagger-ui.oauth.client-id=swagger-ui
springdoc.oauthflow.authorization-url=http://identity/realms/Yas/protocol/openid-connect/auth
springdoc.oauthflow.token-url=http://identity/realms/Yas/protocol/openid-connect/token
springdoc.oauthflow.token-url=http://identity/realms/Yas/protocol/openid-connect/token

spring.retry.maxAttempts=3

resilience4j.circuitbreaker.instances.customer-circuitbreaker.sliding-window-type=COUNT_BASED
resilience4j.circuitbreaker.instances.customer-circuitbreaker.failure-rate-threshold=50
resilience4j.circuitbreaker.instances.customer-circuitbreaker.minimum-number-of-calls=5
resilience4j.circuitbreaker.instances.customer-circuitbreaker.automatic-transition-from-open-to-half-open-enabled=true
resilience4j.circuitbreaker.instances.customer-circuitbreaker.permitted-number-of-calls-in-half-open-state=3
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.yas.inventory.config;

import org.springframework.retry.annotation.EnableRetry;

@EnableRetry
public class RetryConfig {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.yas.inventory.service;

import lombok.extern.slf4j.Slf4j;

@Slf4j
abstract class AbstractCircuitBreakFallbackHandler {

protected void handleBodilessFallback(Throwable throwable) throws Throwable {

Check warning on line 8 in inventory/src/main/java/com/yas/inventory/service/AbstractCircuitBreakFallbackHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def modifier' has incorrect indentation level 2, expected level should be 4.
handleError(throwable);

Check warning on line 9 in inventory/src/main/java/com/yas/inventory/service/AbstractCircuitBreakFallbackHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def' child has incorrect indentation level 4, expected level should be 8.
}

Check warning on line 10 in inventory/src/main/java/com/yas/inventory/service/AbstractCircuitBreakFallbackHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def rcurly' has incorrect indentation level 2, expected level should be 4.

protected Object handleFallback(Throwable throwable) throws Throwable {

Check warning on line 12 in inventory/src/main/java/com/yas/inventory/service/AbstractCircuitBreakFallbackHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def modifier' has incorrect indentation level 2, expected level should be 4.
handleError(throwable);

Check warning on line 13 in inventory/src/main/java/com/yas/inventory/service/AbstractCircuitBreakFallbackHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def' child has incorrect indentation level 4, expected level should be 8.
return null;

Check warning on line 14 in inventory/src/main/java/com/yas/inventory/service/AbstractCircuitBreakFallbackHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def' child has incorrect indentation level 4, expected level should be 8.
}

Check warning on line 15 in inventory/src/main/java/com/yas/inventory/service/AbstractCircuitBreakFallbackHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def rcurly' has incorrect indentation level 2, expected level should be 4.

private void handleError(Throwable throwable) throws Throwable {

Check warning on line 17 in inventory/src/main/java/com/yas/inventory/service/AbstractCircuitBreakFallbackHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def modifier' has incorrect indentation level 2, expected level should be 4.
log.error("Circuit breaker records an error. Detail {}", throwable.getMessage());

Check warning on line 18 in inventory/src/main/java/com/yas/inventory/service/AbstractCircuitBreakFallbackHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def' child has incorrect indentation level 4, expected level should be 8.
throw throwable;

Check warning on line 19 in inventory/src/main/java/com/yas/inventory/service/AbstractCircuitBreakFallbackHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def' child has incorrect indentation level 4, expected level should be 8.
}

Check warning on line 20 in inventory/src/main/java/com/yas/inventory/service/AbstractCircuitBreakFallbackHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck

'method def rcurly' has incorrect indentation level 2, expected level should be 4.
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
import com.yas.inventory.viewmodel.address.AddressDetailVm;
import com.yas.inventory.viewmodel.address.AddressPostVm;
import com.yas.inventory.viewmodel.address.AddressVm;
import io.github.resilience4j.circuitbreaker.annotation.CircuitBreaker;
import java.net.URI;
import lombok.RequiredArgsConstructor;
import org.springframework.retry.annotation.Retryable;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.oauth2.jwt.Jwt;
import org.springframework.stereotype.Service;
Expand All @@ -14,10 +16,12 @@

@Service
@RequiredArgsConstructor
public class LocationService {
public class LocationService extends AbstractCircuitBreakFallbackHandler {
private final RestClient restClient;
private final ServiceUrlConfig serviceUrlConfig;

@Retryable(maxAttemptsExpression = "${spring.retry.maxAttempts}")
@CircuitBreaker(name = "cart-circuitbreaker", fallbackMethod = "handleFallback")
public AddressDetailVm getAddressById(Long id) {
final String jwt =
((Jwt) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getTokenValue();
Expand All @@ -34,6 +38,8 @@ public AddressDetailVm getAddressById(Long id) {
.body(AddressDetailVm.class);
}

@Retryable(maxAttemptsExpression = "${spring.retry.maxAttempts}")
@CircuitBreaker(name = "inventory-circuitbreaker", fallbackMethod = "handleFallback")
public AddressVm createAddress(AddressPostVm addressPostVm) {
final String jwt =
((Jwt) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getTokenValue();
Expand All @@ -51,6 +57,8 @@ public AddressVm createAddress(AddressPostVm addressPostVm) {
.body(AddressVm.class);
}

@Retryable(maxAttemptsExpression = "${spring.retry.maxAttempts}")
@CircuitBreaker(name = "inventory-circuitbreaker", fallbackMethod = "handleBodilessFallback")
public void updateAddress(Long id, AddressPostVm addressPostVm) {
final String jwt =
((Jwt) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getTokenValue();
Expand All @@ -69,6 +77,8 @@ public void updateAddress(Long id, AddressPostVm addressPostVm) {
.body(Void.class);
}

@Retryable(maxAttemptsExpression = "${spring.retry.maxAttempts}")
@CircuitBreaker(name = "inventory-circuitbreaker", fallbackMethod = "handleBodilessFallback")
public void deleteAddress(Long addressId) {
final URI url = UriComponentsBuilder.fromHttpUrl(serviceUrlConfig.location()).path("/storefront/addresses/{id}")
.buildAndExpand(addressId).toUri();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.yas.inventory.utils.AuthenticationUtils;
import com.yas.inventory.viewmodel.product.ProductInfoVm;
import com.yas.inventory.viewmodel.product.ProductQuantityPostVm;
import io.github.resilience4j.circuitbreaker.annotation.CircuitBreaker;
import java.net.URI;
import java.util.List;
import java.util.stream.Collectors;
Expand All @@ -21,10 +22,11 @@

@Service
@RequiredArgsConstructor
public class ProductService {
public class ProductService extends AbstractCircuitBreakFallbackHandler {
private final RestClient restClient;
private final ServiceUrlConfig serviceUrlConfig;

@CircuitBreaker(name = "inventory-circuitbreaker", fallbackMethod = "handleFallback")
public ProductInfoVm getProduct(Long id) {
String jwt = AuthenticationUtils.extractJwt();

Expand All @@ -40,6 +42,7 @@ public ProductInfoVm getProduct(Long id) {
.body(ProductInfoVm.class);
}

@CircuitBreaker(name = "inventory-circuitbreaker", fallbackMethod = "handleFallback")
public List<ProductInfoVm> filterProducts(String productName, String productSku,
List<Long> productIds, FilterExistInWhSelection selection) {

Expand All @@ -66,6 +69,7 @@ public List<ProductInfoVm> filterProducts(String productName, String productSku,
.getBody();
}

@CircuitBreaker(name = "inventory-circuitbreaker", fallbackMethod = "handleBodilessFallback")
public void updateProductQuantity(List<ProductQuantityPostVm> productQuantityPostVms) {
final String jwt =
((Jwt) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getTokenValue();
Expand Down
5 changes: 5 additions & 0 deletions inventory/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,8 @@ springdoc.swagger-ui.oauth.client-id=swagger-ui
springdoc.oauthflow.authorization-url=http://identity/realms/Yas/protocol/openid-connect/auth
springdoc.oauthflow.token-url=http://identity/realms/Yas/protocol/openid-connect/token

resilience4j.circuitbreaker.instances.inventory-circuitbreaker.sliding-window-type=COUNT_BASED
resilience4j.circuitbreaker.instances.inventory-circuitbreaker.failure-rate-threshold=50
resilience4j.circuitbreaker.instances.inventory-circuitbreaker.minimum-number-of-calls=5
resilience4j.circuitbreaker.instances.inventory-circuitbreaker.automatic-transition-from-open-to-half-open-enabled=true
resilience4j.circuitbreaker.instances.inventory-circuitbreaker.permitted-number-of-calls-in-half-open-state=3
12 changes: 12 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,18 @@
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-circuitbreaker-resilience4j</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
</dependency>
</dependencies>
<build>
<pluginManagement>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.yas.webhook.config;

import org.springframework.retry.annotation.EnableRetry;

@EnableRetry
public class RetryCircuitBreakerConfig {

}

0 comments on commit 3c77282

Please sign in to comment.