|  |  |  | 
|---|
|  |  |  | package com.genersoft.iot.vmp.conf; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | 
|---|
|  |  |  | import com.alibaba.fastjson2.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; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | private IRedisCatchStorage redisCatchStorage; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SipConfig sipConfig; | 
|---|
|  |  |  | private IMediaServerService mediaServerService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Value("${server.port}") | 
|---|
|  |  |  | private int serverPort; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private MediaConfig mediaConfig; | 
|---|
|  |  |  | private SipConfig sipConfig; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Scheduled(cron="0/2 * *  * * ? ")   //每3秒执行一次 | 
|---|
|  |  |  | @Scheduled(fixedRate = 2 * 1000)   //每3秒执行一次 | 
|---|
|  |  |  | public void execute(){ | 
|---|
|  |  |  | //        redisCatchStorage.updateWVPInfo(); | 
|---|
|  |  |  | JSONObject jsonObject = new JSONObject(); | 
|---|
|  |  |  | jsonObject.put("ip", sipConfig.getIp()); | 
|---|
|  |  |  | jsonObject.put("port", serverPort); | 
|---|
|  |  |  | redisCatchStorage.updateWVPInfo(jsonObject, 3); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|