| | |
| | | package com.genersoft.iot.vmp.gb28181.event.platformNotRegister; |
| | | |
| | | import com.genersoft.iot.vmp.conf.DynamicTask; |
| | | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| | | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| | |
| | | private IVideoManagerStorage storager; |
| | | @Autowired |
| | | private ISIPCommanderForPlatform sipCommanderFroPlatform; |
| | | @Autowired |
| | | private DynamicTask dynamicTask; |
| | | |
| | | @Override |
| | | public void onApplicationEvent(PlatformCycleRegisterEvent event) { |
| | |
| | | logger.info("[ 平台未注册事件 ] 平台已经删除!!! 平台国标ID:" + event.getPlatformGbID()); |
| | | return; |
| | | } |
| | | Timer timer = new Timer(); |
| | | String taskKey = "platform-cycle-register" + parentPlatform.getServerGBId();; |
| | | SipSubscribe.Event okEvent = (responseEvent)->{ |
| | | timer.cancel(); |
| | | dynamicTask.stop(taskKey); |
| | | }; |
| | | sipCommanderFroPlatform.register(parentPlatform, null, okEvent); |
| | | timer.schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | logger.info("[平台注册]再次向平台注册,平台国标ID:" + event.getPlatformGbID()); |
| | | sipCommanderFroPlatform.register(parentPlatform, null, okEvent); |
| | | } |
| | | }, 15*1000 ,Long.parseLong(parentPlatform.getExpires())* 1000); |
| | | dynamicTask.startCron(taskKey, ()->{ |
| | | logger.info("[平台注册]再次向平台注册,平台国标ID:" + event.getPlatformGbID()); |
| | | sipCommanderFroPlatform.register(parentPlatform, null, okEvent); |
| | | }, Integer.parseInt(parentPlatform.getExpires())* 1000); |
| | | } |
| | | } |