KB66 PostResource#postComment: Return Uni<Response>.
Change-Id: I58ea7a2abd24b2f45b80f401ad0506a698993a9b
diff --git a/pom.xml b/pom.xml
index bacda3e..b4ed900 100644
--- a/pom.xml
+++ b/pom.xml
@@ -173,6 +173,10 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy-mutiny</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-qute</artifactId>
</dependency>
<dependency>
diff --git a/src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java b/src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java
index 569c535..1870709 100644
--- a/src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java
+++ b/src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java
@@ -26,6 +26,7 @@
import io.quarkus.qute.TemplateExtension;
import io.quarkus.qute.TemplateInstance;
import io.quarkus.security.identity.SecurityIdentity;
+import io.smallrye.mutiny.Uni;
import java.math.BigInteger;
import java.net.URI;
import java.net.URLEncoder;
@@ -47,7 +48,6 @@
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors;
import javax.annotation.CheckForNull;
@@ -309,7 +309,7 @@
@Produces(TEXT_PLAIN)
@Path("{id}/comments")
@Transactional
- public Response postComment(
+ public Uni<Response> postComment(
@PathParam("id") int postId,
@FormParam("message") @NotEmpty String message,
@FormParam("hashcash-salt") long hashcashSalt)
@@ -358,9 +358,10 @@
.to(mailSenderAddress)
.bcc(admins.stream().map(x -> x.email).toArray(String[]::new))
.send();
- sendJob.subscribe().asCompletionStage().get(10000, TimeUnit.SECONDS);
-
- return Response.seeOther(UriBuilder.fromUri("/posts/{id}").build(postId)).build();
+ return sendJob
+ .onItem()
+ .transform(
+ unused -> Response.seeOther(UriBuilder.fromUri("/posts/{id}").build(postId)).build());
}
private String makeFeed(