All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.wslxm.springbootplus2.starter.websocket.topic.WebsocketMsgPublisher Maven / Gradle / Ivy

package io.github.wslxm.springbootplus2.starter.websocket.topic;

import io.github.wslxm.springbootplus2.starter.websocket.model.vo.SendMsgVO;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.listener.ChannelTopic;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**websocket味精出版商
 * 发布者
 * @author wangsong
 * @date 2023/05/17
 */
@Component
public class WebsocketMsgPublisher {

    @Resource
    private RedisTemplate redisTemplate;

    @Resource
    private ChannelTopic topic;

    public void sendMsg(SendMsgVO sendMsgVO ) {
        redisTemplate.convertAndSend(topic.getTopic(),  sendMsgVO);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy