From 180d25cfcbec4e757c23b7a2e80077a34d024b73 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sun, 12 Jun 2022 00:34:05 +0200 Subject: [PATCH] redis work in progress --- pom.xml | 4 ++++ .../com/covas/Resources/MailRessource.java | 22 ++++++++++++++----- src/main/resources/application.properties | 7 +++++- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 7eafd45..f40a5b9 100644 --- a/pom.xml +++ b/pom.xml @@ -76,6 +76,10 @@ io.quarkus quarkus-resteasy-qute + + io.quarkus + quarkus-redis-client + io.quarkus quarkus-junit5 diff --git a/src/main/java/com/covas/Resources/MailRessource.java b/src/main/java/com/covas/Resources/MailRessource.java index 5cdc2ad..e475f9f 100644 --- a/src/main/java/com/covas/Resources/MailRessource.java +++ b/src/main/java/com/covas/Resources/MailRessource.java @@ -1,8 +1,7 @@ package com.covas.Resources; +import java.util.Arrays; import java.util.UUID; -import java.util.concurrent.CompletionStage; -import java.util.concurrent.Flow; import javax.inject.Inject; import javax.ws.rs.GET; @@ -13,8 +12,7 @@ import javax.ws.rs.core.Response; import com.covas.Entity.UsersEntity; import io.quarkus.mailer.MailTemplate; -import io.quarkus.qute.CheckedTemplate; -import io.smallrye.mutiny.Uni; +import io.quarkus.redis.client.RedisClient; @Path("mail") public class MailRessource { @@ -22,8 +20,9 @@ public class MailRessource { @Inject private MailTemplate mailer; + @Inject + RedisClient redisClient; - @GET public Response sendMail(UsersEntity users){ @@ -43,5 +42,18 @@ public class MailRessource { return Response.ok().build(); } + @GET + @Path("set-redis") + public Response setRedis(){ + redisClient.set(Arrays.asList("toto","sss")); + return Response.ok().build(); + } + + @GET + @Path("get-redis/{id}") + public Response getRedis(@PathParam("id") String id){ + return Response.ok().entity(redisClient.get(id)).build(); + } + } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index efaf00f..60ba02a 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -20,4 +20,9 @@ quarkus.mailer.port=587 quarkus.mailer.start-tls=REQUIRED quarkus.mailer.username=valczebackup@gmail.com quarkus.mailer.password=aohrpmqvxldwyebs -quarkus.mailer.mock=false \ No newline at end of file +quarkus.mailer.mock=false + + + +quarkus.redis.hosts=redis://localhost:6379 +