优化报警推送心跳定时任务
parent
bf9262283e
commit
caaaaacb89
|
@ -1,5 +1,6 @@
|
|||
package com.genersoft.iot.vmp.gb28181.controller;
|
||||
|
||||
import com.genersoft.iot.vmp.conf.DynamicTask;
|
||||
import com.genersoft.iot.vmp.gb28181.event.alarm.AlarmEventListener;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
@ -28,6 +29,9 @@ public class SseController {
|
|||
@Resource
|
||||
private AlarmEventListener alarmEventListener;
|
||||
|
||||
@Resource
|
||||
private DynamicTask dynamicTask;
|
||||
|
||||
/**
|
||||
* SSE 推送.
|
||||
*
|
||||
|
@ -45,11 +49,13 @@ public class SseController {
|
|||
PrintWriter writer = response.getWriter();
|
||||
alarmEventListener.addSseEmitter(browserId, writer);
|
||||
|
||||
while (!writer.checkError()) {
|
||||
Thread.sleep(1000);
|
||||
dynamicTask.startCron("sse-key", new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
writer.write(":keep alive\n\n");
|
||||
writer.flush();
|
||||
}
|
||||
}, 1000);
|
||||
alarmEventListener.removeSseEmitter(browserId, writer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,14 +7,13 @@ import com.genersoft.iot.vmp.gb28181.bean.Device;
|
|||
import com.genersoft.iot.vmp.gb28181.bean.GbSipDate;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.RemoteAddressInfo;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.SipTransactionInfo;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IDeviceService;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.SIPSender;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
|
||||
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IDeviceService;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import gov.nist.javax.sip.RequestEventExt;
|
||||
import gov.nist.javax.sip.address.AddressImpl;
|
||||
import gov.nist.javax.sip.address.SipUri;
|
||||
import gov.nist.javax.sip.header.SIPDateHeader;
|
||||
|
@ -77,8 +76,6 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
|
|||
@Override
|
||||
public void process(RequestEvent evt) {
|
||||
try {
|
||||
RequestEventExt evtExt = (RequestEventExt) evt;
|
||||
|
||||
SIPRequest request = (SIPRequest) evt.getRequest();
|
||||
Response response = null;
|
||||
boolean passwordCorrect = false;
|
||||
|
|
|
@ -120,7 +120,7 @@ export default {
|
|||
that.$notify({
|
||||
title: '报警信息',
|
||||
dangerouslyUseHTMLString: true,
|
||||
message: `<strong>设备:</strong> <i> ${data.deviceId}</i>` +
|
||||
message: `<strong>设备编号:</strong> <i> ${data.deviceId}</i>` +
|
||||
`<br><strong>通道编号:</strong> <i>${ data.channelId}</i>` +
|
||||
`<br><strong>报警级别:</strong> <i>${ data.alarmPriorityDescription}</i>` +
|
||||
`<br><strong>报警方式:</strong> <i>${ data.alarmMethodDescription}</i>` +
|
||||
|
|
Loading…
Reference in New Issue