Open pragnagopa opened 5 years ago
@anuchandy @selvasingh
@pragnagopa was this ever implemented?
Not yet. We are tracking this as a feature request.
@pragnagopa @amamounelsayed
Is it possible to receive async responses with azure functions? Because I don't receive any errors when the mail can not be sent which I receive on my local environment (e.g. 500 - Internal Server error, when password is wrong).
Source from: https://quarkus.io/guides/mailer#sending-simple-emails
GET
@Path("/async")
public CompletionStage<Response> sendASimpleEmailAsync() {
return reactiveMailer.send(
Mail.withText("to@acme.org", "A reactive email from quarkus", "This is my body"))
.subscribeAsCompletionStage()
.thenApply(x -> Response.accepted().build());
}
How about returning Mono or Flux?
Hi @amamounelsayed ,
We have users asking about this capability in spring-cloud-function and It would be helpful to get an idea where this feature request stands wrt to the overall product roadmap / backlog. Can you give an update on this?
Thanks.
Hi @onobc , thanks for reaching out. I would like to understand more how customer will be using mono/flux returned by functions. Do we have some solid user cases that I can take a look and think about. Thanks.
Hi @kaibocai , I have been out on PTO and have not had a chance to get the requested info. I just wanted to reach out and tell you thanks for the reply and I will get you that info sometime in the next week.
Hi @kaibocai , one specific scenario is user sending a JMS message for each item in the returned flux. Other than that I believe it is mostly Reactive enthusiasts wanting their Reactive APIs.
I do think there is also another not-so-obvious use case - the use of non-blocking APIs in the function implementation code. Currently, there is not much benefit for using a Reactive API w/in the function logic as ultimately it will be blocked upon function invocation. Adding this support would also expand the Reactive footprint[^1] of the function call - leading to more "Reactive benefits". Here are a couple of related issues (not directly to Reactive but more of non-blocking in general):
[^1]: Sidenote - I visualize the Reactive code surrounded with a "reactive membrane" that separates it from the other imperative code. The bigger this membrane, the bigger the reactive footprint and therefore the more benefits we receive from "buying into" reactive .
How about returning Mono or Flux?
@pragnagopa @amamounelsayed
Is it possible to receive async responses with azure functions? Because I don't receive any errors when the mail can not be sent which I receive on my local environment (e.g. 500 - Internal Server error, when password is wrong).
Source from: https://quarkus.io/guides/mailer#sending-simple-emails
GET @Path("/async") public CompletionStage<Response> sendASimpleEmailAsync() { return reactiveMailer.send( Mail.withText("to@acme.org", "A reactive email from quarkus", "This is my body")) .subscribeAsCompletionStage() .thenApply(x -> Response.accepted().build()); }
Hi @Kondamon , can you provide the full code of your function code. It will help me understand the full picture. Thanks a lot.
@kaibocai in my case I‘m not using async anymore since there were no benefits in my use case. The example was from https://quarkus.io/guides/mailer-reference
Any fix for returning HttpResponseMessage as Mono
Add support for functions to run async. For example
Java worker should inspect function method signature, if it returns a
Future
invoke it asynchronously and if not invoke the method synchronously.