package com.ld.igds.mq;
|
|
import com.ld.igds.io.constant.ProtocolEnum;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.stereotype.Component;
|
|
/**
|
* 消息队列信息发布入口
|
*/
|
@Component
|
public class RedisPublishService {
|
|
@Autowired
|
private RedisTemplate<String, Object> redisTemplate;
|
|
public void publish(String topic, String msg) {
|
|
if (null == msg) return;
|
|
if (null == topic) topic = ProtocolEnum.TCP_DEFAULT.getCode();
|
|
redisTemplate.convertAndSend(topic, msg);
|
}
|
}
|