支持设备/通道状态变化时发送redis通知
This commit is contained in:
@@ -261,4 +261,6 @@ public interface IRedisCatchStorage {
|
||||
List<Device> getAllDevices();
|
||||
|
||||
void removeAllDevice();
|
||||
|
||||
void sendDeviceOrChannelStatus(String deviceId, String channelId, boolean online);
|
||||
}
|
||||
|
||||
@@ -902,4 +902,18 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
+ userSetting.getServerId() + "_*_" + id + "_*";
|
||||
return RedisUtil.scan(redisTemplate, key).size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendDeviceOrChannelStatus(String deviceId, String channelId, boolean online) {
|
||||
String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_DEVICE_STATUS;
|
||||
logger.info("[redis通知] 推送设备/通道状态, {}/{}-{}", deviceId, channelId, online);
|
||||
StringBuilder msg = new StringBuilder();
|
||||
msg.append(deviceId);
|
||||
if (channelId != null) {
|
||||
msg.append(":").append(channelId);
|
||||
}
|
||||
msg.append(" ").append(online? "ON":"OFF");
|
||||
|
||||
redisTemplate.convertAndSend(key, msg.toString());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user