|
@@ -1,8 +1,12 @@
|
|
|
package com.genersoft.iot.vmp.media.zlm.event;
|
|
package com.genersoft.iot.vmp.media.zlm.event;
|
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
|
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
|
|
import com.genersoft.iot.vmp.conf.UserSetup;
|
|
import com.genersoft.iot.vmp.conf.UserSetup;
|
|
|
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
|
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
|
|
|
|
+import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
|
|
|
|
+import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
|
|
|
|
+import com.genersoft.iot.vmp.service.IMediaServerService;
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -24,9 +28,15 @@ public class ZLMKeepliveTimeoutListener extends KeyExpirationEventMessageListene
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private EventPublisher publisher;
|
|
private EventPublisher publisher;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ZLMRESTfulUtils zlmresTfulUtils;
|
|
|
|
|
+
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private UserSetup userSetup;
|
|
private UserSetup userSetup;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IMediaServerService mediaServerService;
|
|
|
|
|
+
|
|
|
public ZLMKeepliveTimeoutListener(RedisMessageListenerContainer listenerContainer) {
|
|
public ZLMKeepliveTimeoutListener(RedisMessageListenerContainer listenerContainer) {
|
|
|
super(listenerContainer);
|
|
super(listenerContainer);
|
|
|
// 配置springboot默认Config为空,即不让应用去修改redis的默认配置,因为Redis服务出于安全会禁用CONFIG命令给远程用户使用
|
|
// 配置springboot默认Config为空,即不让应用去修改redis的默认配置,因为Redis服务出于安全会禁用CONFIG命令给远程用户使用
|
|
@@ -48,7 +58,12 @@ public class ZLMKeepliveTimeoutListener extends KeyExpirationEventMessageListene
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
String mediaServerId = expiredKey.substring(KEEPLIVEKEY_PREFIX.length(),expiredKey.length());
|
|
String mediaServerId = expiredKey.substring(KEEPLIVEKEY_PREFIX.length(),expiredKey.length());
|
|
|
|
|
+ // 发起http请求验证zlm是否确实无法连接,如果确实无法连接则发送离线事件,否则不作处理
|
|
|
|
|
+ MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId);
|
|
|
|
|
+ JSONObject mediaServerConfig = zlmresTfulUtils.getMediaServerConfig(mediaServerItem);
|
|
|
|
|
+ if (mediaServerConfig == null) {
|
|
|
|
|
+ publisher.zlmOfflineEventPublish(mediaServerId);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- publisher.zlmOfflineEventPublish(mediaServerId);
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|