mercredi 22 avril 2020

Is it possible to use another circuit breaker over fallback method?

I have a requirement to implement circuit breaker in a java based microservice such that if there are defined number of failures from backendA then fallback method should call to another backendB, and if backendB also fails then there should be another fallback method to return error from Java API itself.Is it possible, more importantly is it advisable to implement such design.If someone can give any reference or examples where such patterns is used. I will be using resilience4j library to do so. The code structure will look something like this:

@CircuitBreaker(name = "backendA", fallbackMethod = "fallback1")
{Method to call backendA}//Threshold value : 10 requests

@CircuitBreaker(name = "backendB", fallbackMethod = "fallback2")
private String fallback1() { Method to call backendB} // Threshold value : 2 requests


private String fallback2() { Method to return error}

Aucun commentaire:

Enregistrer un commentaire