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