From 25836328835ca4f017658ab546b654a5e5b92c09 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子Li <15040126243@163.com> Date: 星期四, 25 四月 2024 12:50:42 +0800 Subject: [PATCH] update springboot 3.2.4 => 3.2.5 update mybatis-plus 3.5.5 => 3.5.6 适配更改代码 update springdoc 2.4.0 => 2.5.0 update easyexcel 3.3.3 => 3.3.4 update redisson 3.27.2 => 3.29.0 update lombok 1.18.30 => 1.18.32 update sms4j 3.2.0 => 3.2.1 --- ruoyi-common/ruoyi-common-redis/src/main/java/org/dromara/common/redis/utils/QueueUtils.java | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 57 insertions(+), 1 deletions(-) diff --git a/ruoyi-common/ruoyi-common-redis/src/main/java/org/dromara/common/redis/utils/QueueUtils.java b/ruoyi-common/ruoyi-common-redis/src/main/java/org/dromara/common/redis/utils/QueueUtils.java index 45b5496..4587e64 100644 --- a/ruoyi-common/ruoyi-common-redis/src/main/java/org/dromara/common/redis/utils/QueueUtils.java +++ b/ruoyi-common/ruoyi-common-redis/src/main/java/org/dromara/common/redis/utils/QueueUtils.java @@ -132,6 +132,32 @@ } /** + * 浼樺厛闃熷垪鑾峰彇涓�涓槦鍒楁暟鎹� 娌℃湁鏁版嵁杩斿洖 null(涓嶆敮鎸佸欢杩熼槦鍒�) + * + * @param queueName 闃熷垪鍚� + */ + public static <T> T getPriorityQueueObject(String queueName) { + RPriorityBlockingQueue<T> queue = CLIENT.getPriorityBlockingQueue(queueName); + return queue.poll(); + } + + /** + * 浼樺厛闃熷垪鍒犻櫎闃熷垪鏁版嵁(涓嶆敮鎸佸欢杩熼槦鍒�) + */ + public static <T> boolean removePriorityQueueObject(String queueName, T data) { + RPriorityBlockingQueue<T> queue = CLIENT.getPriorityBlockingQueue(queueName); + return queue.remove(data); + } + + /** + * 浼樺厛闃熷垪閿�姣侀槦鍒� 鎵�鏈夐樆濉炵洃鍚� 鎶ラ敊(涓嶆敮鎸佸欢杩熼槦鍒�) + */ + public static <T> boolean destroyPriorityQueue(String queueName) { + RPriorityBlockingQueue<T> queue = CLIENT.getPriorityBlockingQueue(queueName); + return queue.delete(); + } + + /** * 灏濊瘯璁剧疆 鏈夌晫闃熷垪 瀹归噺 鐢ㄤ簬闄愬埗鏁伴噺 * * @param queueName 闃熷垪鍚� @@ -170,10 +196,40 @@ } /** + * 鏈夌晫闃熷垪鑾峰彇涓�涓槦鍒楁暟鎹� 娌℃湁鏁版嵁杩斿洖 null(涓嶆敮鎸佸欢杩熼槦鍒�) + * + * @param queueName 闃熷垪鍚� + */ + public static <T> T getBoundedQueueObject(String queueName) { + RBoundedBlockingQueue<T> queue = CLIENT.getBoundedBlockingQueue(queueName); + return queue.poll(); + } + + /** + * 鏈夌晫闃熷垪鍒犻櫎闃熷垪鏁版嵁(涓嶆敮鎸佸欢杩熼槦鍒�) + */ + public static <T> boolean removeBoundedQueueObject(String queueName, T data) { + RBoundedBlockingQueue<T> queue = CLIENT.getBoundedBlockingQueue(queueName); + return queue.remove(data); + } + + /** + * 鏈夌晫闃熷垪閿�姣侀槦鍒� 鎵�鏈夐樆濉炵洃鍚� 鎶ラ敊(涓嶆敮鎸佸欢杩熼槦鍒�) + */ + public static <T> boolean destroyBoundedQueue(String queueName) { + RBoundedBlockingQueue<T> queue = CLIENT.getBoundedBlockingQueue(queueName); + return queue.delete(); + } + + /** * 璁㈤槄闃诲闃熷垪(鍙闃呮墍鏈夊疄鐜扮被 渚嬪: 寤惰繜 浼樺厛 鏈夌晫 绛�) */ - public static <T> void subscribeBlockingQueue(String queueName, Consumer<T> consumer) { + public static <T> void subscribeBlockingQueue(String queueName, Consumer<T> consumer, boolean isDelayed) { RBlockingQueue<T> queue = CLIENT.getBlockingQueue(queueName); + if (isDelayed) { + // 璁㈤槄寤惰繜闃熷垪 + CLIENT.getDelayedQueue(queue); + } queue.subscribeOnElements(consumer); } -- Gitblit v1.9.3