|
@@ -0,0 +1,18 @@
|
|
|
+package com.fdkankan.redis.util;
|
|
|
+
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.redis.core.RedisTemplate;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+@Component
|
|
|
+@Slf4j
|
|
|
+public class RedisMqUtils {
|
|
|
+ @Autowired
|
|
|
+ private RedisTemplate redisTemplate;
|
|
|
+
|
|
|
+ public void publisMsg(String topic, String content) {
|
|
|
+ log.info("发布redis消息,topic:{},content:{}", topic, content);
|
|
|
+ redisTemplate.convertAndSend(topic, content);
|
|
|
+ }
|
|
|
+}
|