Transform return GET in Response Imperative
This commit is contained in:
parent
4dedad4528
commit
b2389b5ef8
@ -1,35 +1,32 @@
|
|||||||
package com.covas.Resources;
|
package com.covas.Resources;
|
||||||
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.concurrent.CompletionStage;
|
import java.util.concurrent.CompletionStage;
|
||||||
|
import java.util.concurrent.Flow;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
import io.quarkus.mailer.Mail;
|
|
||||||
import io.quarkus.mailer.MailTemplate;
|
|
||||||
import io.quarkus.mailer.reactive.ReactiveMailer;
|
|
||||||
|
|
||||||
|
import io.quarkus.mailer.MailTemplate;
|
||||||
|
import io.quarkus.qute.CheckedTemplate;
|
||||||
|
import io.smallrye.mutiny.Uni;
|
||||||
|
|
||||||
@Path("mail")
|
@Path("mail")
|
||||||
public class MailRessource {
|
public class MailRessource {
|
||||||
|
|
||||||
@Inject
|
|
||||||
private ReactiveMailer mail;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private MailTemplate hello;
|
private MailTemplate hello;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("async")
|
public Response sendMail(){
|
||||||
public CompletionStage<Response> sendMail(){
|
|
||||||
//return mail.send(Mail.withText("valcze80@gmail.com", "async", "toto"))
|
hello.to("valcze808@gmail.com").subject("test").data("name", "Robert").send().subscribeAsCompletionStage();
|
||||||
//.subscribeAsCompletionStage()
|
return Response.ok().build();
|
||||||
//.thenApply(x -> Response.accepted().build());
|
|
||||||
return hello.to("valcze80@gmail.com").subject("test").data("name", "Robert").send().subscribeAsCompletionStage().thenApply(x -> Response.accepted().build());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user