Fallback

On the other hand, Istio does not have a fallback policy for when all the retries fail – it is not possible to have Istio call another version of your workload. When you annotate the preceding code with the @Fallback annotation, it is possible to execute another action in case the original call fails:

@Fallback(fallbackMethod = "fallbackForA")@Retry (maxRetries = 3)string aMethod() {   callBackend();}void String fallbackForA() {    return "A cached string";}

In this case, the fallbackForA fallback method will be called once all the retries from Istio, times those from MicroProfile, have been exhausted. If you remove the @Retry annotation from the preceding example, the fallback method is called when the Istio retries have been exhausted. ...

Get Hands-On Enterprise Java Microservices with Eclipse MicroProfile now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.