Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure_function does not support returning a Mono from the controller when that Mono is created in a separate thread #319

Open
AaldertVanWijk-TomTom opened this issue Apr 13, 2022 · 1 comment

Comments

@AaldertVanWijk-TomTom
Copy link
Contributor

AaldertVanWijk-TomTom commented Apr 13, 2022

Expected Behavior

I would expect to be able to use the ability of Micronaut to return mono's from the Controller

Actual Behaviour

Returning a mono in the controller results in an empty response, when the creation of that mono is actually done on a separate thread.

    @Get("/mono")
    public Mono<String> mono(){
        return googleClient.healthMono().log();
    }

It's interesting, to see that there is no problem if we wrap the response in a flux:

    @Get("/flux")
    public Flux<String> flux() {
        return Flux.from(googleClient.healthMono()).log();
    }

Steps To Reproduce

As far as I can see returning a mono from an azure-http-function will fail when some of the work to create the mono is done on a separate thread.

I created a repository that shows the problem in it's shortest possible form.

https://github.com/AaldertVanWijk-TomTom/mono-with-azure-function/

The main branch shows the project with the netty runtime, and then all is working just fine. when I make a one letter change to the entire project change netty to jetty two tests start to fail. this is demonstrated on the jetty branch
The branch azure-function shows 3 tests failing when the project is an azure function. again with minimal changes

Environment Information

JDK 11

Example Application

https://github.com/AaldertVanWijk-TomTom/mono-with-azure-function/

Version

3.4.1

@alejojarahi
Copy link

I have the same problem, I am working on migrating from micronaut 2.5.13 an application based on azure function (Micronaut runtime azure_function) to micronaut > 3.0 and I have the same problem with reactor.

@AaldertVanWijk-TomTom AaldertVanWijk-TomTom changed the title Azure http function does not support returning a Mono from the controller when that Mono is created in a separate thread Azure_function does not support returning a Mono from the controller when that Mono is created in a separate thread Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants