Skip to content

Instantly share code, notes, and snippets.

@LokeshAggarwal2
Created August 2, 2020 16:12
Show Gist options
  • Save LokeshAggarwal2/64479425159f7966b09f9159e5e5a795 to your computer and use it in GitHub Desktop.
Save LokeshAggarwal2/64479425159f7966b09f9159e5e5a795 to your computer and use it in GitHub Desktop.
UserRegistrationResilience4j
@Service
public class UserRegistrationResilience4j {
@CircuitBreaker(name = "service1", fallbackMethod = "fallbackForRegisterSeller")
public String registerSeller(SellerDto sellerDto) {
String response = restTemplate.postForObject("/addSeller", sellerDto, String.class);
return response;
}
public String fallbackForRegisterSeller(SellerDto sellerDto, Throwable t) {
return "Inside circuit breaker fallback method";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment