In addition, when developing Microservices it is quite common to work on a single Microservice without other Microservices the project requires being available.

    With that in mind Micronaut features a native fallback mechanism that is integrated into that allows falling back to another implementation in the case of failure.

    In fact the mechanism is not strictly linked to Retry, you can declare any class as @Recoverable and if a method call fails (or, in the case of reactive types, an error is emitted) a class annotated with will be searched for.

    To illustrate this consider again the interface declared earlier. You can define a class that will be called in the case of failure:

    Defining a Fallback

    Defining a Fallback

    Of course, the actual behaviour of the fallback is down to you. You could for example implement a fallback that pulls data from a local cache when the real data is not available, and sends alert emails to operations about downtime or whatever.