优化级联移动位置订阅位置更新
This commit is contained in:
@@ -1,50 +0,0 @@
|
||||
package com.genersoft.iot.vmp.gb28181.event.subscribe;
|
||||
|
||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||
import com.genersoft.iot.vmp.conf.DynamicTask;
|
||||
import com.genersoft.iot.vmp.conf.RedisKeyExpirationEventMessageListener;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.connection.Message;
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 平台订阅到期事件
|
||||
*/
|
||||
@Component
|
||||
public class SubscribeListenerForPlatform extends RedisKeyExpirationEventMessageListener {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(SubscribeListenerForPlatform.class);
|
||||
|
||||
@Autowired
|
||||
private UserSetting userSetting;
|
||||
|
||||
@Autowired
|
||||
private DynamicTask dynamicTask;
|
||||
|
||||
public SubscribeListenerForPlatform(RedisMessageListenerContainer listenerContainer, UserSetting userSetting) {
|
||||
super(listenerContainer, userSetting);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 监听失效的key
|
||||
* @param message
|
||||
* @param pattern
|
||||
*/
|
||||
@Override
|
||||
public void onMessage(Message message, byte[] pattern) {
|
||||
// 获取失效的key
|
||||
String expiredKey = message.toString();
|
||||
logger.debug(expiredKey);
|
||||
// 订阅到期
|
||||
String PLATFORM_KEEPLIVEKEY_PREFIX = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "_";
|
||||
if (expiredKey.startsWith(PLATFORM_KEEPLIVEKEY_PREFIX)) {
|
||||
// 取消定时任务
|
||||
dynamicTask.stop(expiredKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,8 +61,6 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
|
||||
if (event.getPlatformId() != null) {
|
||||
parentPlatform = storager.queryParentPlatByServerGBId(event.getPlatformId());
|
||||
if (parentPlatform != null && !parentPlatform.isStatus())return;
|
||||
String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "_Catalog_" + event.getPlatformId();
|
||||
// subscribe = redisCatchStorage.getSubscribe(key);
|
||||
subscribe = subscribeHolder.getCatalogSubscribe(event.getPlatformId());
|
||||
|
||||
if (subscribe == null) {
|
||||
|
||||
Reference in New Issue
Block a user