From 71a2a8245db4c04be3f96a9eb9b47931d3130650 Mon Sep 17 00:00:00 2001 From: zlyx <1242874891@qq.com> Date: 星期三, 18 一月 2023 17:09:43 +0800 Subject: [PATCH] refactor 重构 common, framework 包结构, 参照 cloud 版本拆分子模块 ; update 更新模块包名 ; delete 移除 sms 模块, oss 模块, framework 模块 (并入 common 模块) ; --- ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisPubSubController.java | 20 ++++++++++++++------ 1 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisPubSubController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisPubSubController.java index 344abc1..6ad80ce 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisPubSubController.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisPubSubController.java @@ -1,9 +1,7 @@ package com.ruoyi.demo.controller; import com.ruoyi.common.core.domain.R; -import com.ruoyi.common.utils.redis.RedisUtils; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.tags.Tag; +import com.ruoyi.common.redis.utils.RedisUtils; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -14,22 +12,32 @@ * * @author Lion Li */ -@Tag(name ="Redis鍙戝竷璁㈤槄 婕旂ず妗堜緥", description = "Redis鍙戝竷璁㈤槄") @RequiredArgsConstructor @RestController @RequestMapping("/demo/redis/pubsub") public class RedisPubSubController { + /** + * 鍙戝竷娑堟伅 + * + * @param key 閫氶亾Key + * @param value 鍙戦�佸唴瀹� + */ @GetMapping("/pub") - public R<Void> pub(@Parameter(name = "閫氶亾Key") String key, @Parameter(name = "鍙戦�佸唴瀹�") String value) { + public R<Void> pub(String key, String value) { RedisUtils.publish(key, value, consumer -> { System.out.println("鍙戝竷閫氶亾 => " + key + ", 鍙戦�佸�� => " + value); }); return R.ok("鎿嶄綔鎴愬姛"); } + /** + * 璁㈤槄娑堟伅 + * + * @param key 閫氶亾Key + */ @GetMapping("/sub") - public R<Void> sub(@Parameter(name = "閫氶亾Key") String key) { + public R<Void> sub(String key) { RedisUtils.subscribe(key, String.class, msg -> { System.out.println("璁㈤槄閫氶亾 => " + key + ", 鎺ユ敹鍊� => " + msg); }); -- Gitblit v1.9.3