Micronaut supports returning common reactive types such as or Observable (or the type from Reactor 3.x), an instance of or CompletableFuture from any controller method.

    The argument that is designated the body of the request using the annotation can also be a reactive type or a CompletableFuture.

    When returning a reactive type Micronaut will subscribe to the returned reactive type on the same thread as the request (A Netty Event Loop thread). It is therefore important that if you perform any blocking operations you offload those operations to an appropriately configured thread pool for example, using RxJava’s subscribeOn(..) facility or .

    To summarize, the following table illustrates some common response types and their handling: