| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.*; |
| | |
| | | |
| | | @Autowired |
| | | private RedisTemplate<Object, Object> redisTemplate; |
| | | |
| | | @Autowired |
| | | private StringRedisTemplate stringRedisTemplate; |
| | | |
| | | @Override |
| | | public Long getCSEQ() { |
| | |
| | | msg.append(":").append(channelId); |
| | | } |
| | | msg.append(" ").append(online? "ON":"OFF"); |
| | | |
| | | redisTemplate.convertAndSend(key, msg.toString()); |
| | | // 使用 RedisTemplate<Object, Object> 发送字符串消息会导致发送的消息多带了双引号 |
| | | stringRedisTemplate.convertAndSend(key, msg.toString()); |
| | | } |
| | | } |