0

Have a controller:

@Controller
@CircuitBreaker
public class ExampleController {

    @Get("/")
    public Single<String> endpoint() {
        return Single.fromSupplier(this::serviceCall);
    }

    private String serviceCall() {
        throw new RuntimeException();
    }
}

Fist call works absolutely fine. However, second call won't fail with the same exception, if happens when CircuitBreaker is open. Instead, it will case CircuitOpenException in micronaut infrastructure that will result in broken request.

Is any workaround for that issue?

Full example: https://github.com/artfable/micronaut-test

Update:

Created an issue: https://github.com/micronaut-projects/micronaut-rxjava3/issues/87

Annotation works fine with Single from rxjava2. So, as a workaround, use service that will have the annotation and return rxjava2 Single, convert to rxjava3 Single in a controller.

0 Answers0