在redis中添加wvp存活依据,添加推流变化消息
This commit is contained in:
@@ -27,6 +27,8 @@ public class UserSetup {
|
||||
|
||||
private Boolean logInDatebase = Boolean.TRUE;
|
||||
|
||||
private String serverId = "000000";
|
||||
|
||||
private List<String> interfaceAuthenticationExcludes = new ArrayList<>();
|
||||
|
||||
public Boolean getSavePositionHistory() {
|
||||
@@ -104,4 +106,12 @@ public class UserSetup {
|
||||
public void setLogInDatebase(Boolean logInDatebase) {
|
||||
this.logInDatebase = logInDatebase;
|
||||
}
|
||||
|
||||
public String getServerId() {
|
||||
return serverId;
|
||||
}
|
||||
|
||||
public void setServerId(String serverId) {
|
||||
this.serverId = serverId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.genersoft.iot.vmp.conf;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @description: 获取数据库配置
|
||||
* @author: swwheihei
|
||||
* @date: 2020年5月6日 下午2:46:00
|
||||
*/
|
||||
@Configuration("vmConfig")
|
||||
public class VManagerConfig {
|
||||
|
||||
@Value("${spring.application.database:redis}")
|
||||
private String database;
|
||||
|
||||
|
||||
public String getDatabase() {
|
||||
return database;
|
||||
}
|
||||
|
||||
public void setDatabase(String database) {
|
||||
this.database = database;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.genersoft.iot.vmp.conf;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -12,13 +15,22 @@ public class WVPTimerTask {
|
||||
private IRedisCatchStorage redisCatchStorage;
|
||||
|
||||
@Autowired
|
||||
private SipConfig sipConfig;
|
||||
private IMediaServerService mediaServerService;
|
||||
|
||||
@Autowired
|
||||
private MediaConfig mediaConfig;
|
||||
private UserSetup userSetup;
|
||||
|
||||
// @Scheduled(cron="0/2 * * * * ? ") //每3秒执行一次
|
||||
// public void execute(){
|
||||
//// redisCatchStorage.updateWVPInfo();
|
||||
// }
|
||||
@Value("${server.port}")
|
||||
private int serverPort;
|
||||
|
||||
@Autowired
|
||||
private SipConfig sipConfig;
|
||||
|
||||
@Scheduled(fixedRate = 2 * 1000) //每3秒执行一次
|
||||
public void execute(){
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("ip", sipConfig.getIp());
|
||||
jsonObject.put("port", serverPort);
|
||||
redisCatchStorage.updateWVPInfo(userSetup.getServerId(), jsonObject, 3);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user