mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-22 05:17:49 +08:00
优化报警和心跳通知的回复方式,改为异步处理
This commit is contained in:
parent
7fcd3d3404
commit
2b090bbf23
@ -66,11 +66,10 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
|||||||
@Override
|
@Override
|
||||||
public void process(RequestEvent evt) {
|
public void process(RequestEvent evt) {
|
||||||
try {
|
try {
|
||||||
responseAck((SIPRequest) evt.getRequest(), Response.OK, null, null);
|
responseAckAsync((SIPRequest) evt.getRequest(), Response.OK);
|
||||||
Element rootElement = getRootElement(evt);
|
Element rootElement = getRootElement(evt);
|
||||||
if (rootElement == null) {
|
if (rootElement == null) {
|
||||||
log.error("处理NOTIFY消息时未获取到消息体,{}", evt.getRequest());
|
log.error("处理NOTIFY消息时未获取到消息体,{}", evt.getRequest());
|
||||||
responseAck((SIPRequest) evt.getRequest(), Response.OK, null, null);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String cmd = XmlUtil.getText(rootElement, "CmdType");
|
String cmd = XmlUtil.getText(rootElement, "CmdType");
|
||||||
|
|||||||
@ -78,6 +78,12 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
|
|||||||
log.error("[Alarm] 待处理消息队列已满 {},返回486 BUSY_HERE,消息不做处理", userSetting.getMaxNotifyCountQueue());
|
log.error("[Alarm] 待处理消息队列已满 {},返回486 BUSY_HERE,消息不做处理", userSetting.getMaxNotifyCountQueue());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 回复200 OK
|
||||||
|
try {
|
||||||
|
responseAckAsync((SIPRequest) evt.getRequest(), Response.OK);
|
||||||
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
|
log.error("[命令发送失败] 报警通知回复: {}", e.getMessage());
|
||||||
|
}
|
||||||
taskQueue.offer(new SipMsgInfo(evt, device, rootElement));
|
taskQueue.offer(new SipMsgInfo(evt, device, rootElement));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,12 +108,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
RequestEvent evt = sipMsgInfo.getEvt();
|
RequestEvent evt = sipMsgInfo.getEvt();
|
||||||
// 回复200 OK
|
|
||||||
try {
|
|
||||||
responseAck((SIPRequest) evt.getRequest(), Response.OK);
|
|
||||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
|
||||||
log.error("[命令发送失败] 报警通知回复: {}", e.getMessage());
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
Device device = sipMsgInfo.getDevice();
|
Device device = sipMsgInfo.getDevice();
|
||||||
Element deviceIdElement = sipMsgInfo.getRootElement().element("DeviceID");
|
Element deviceIdElement = sipMsgInfo.getRootElement().element("DeviceID");
|
||||||
|
|||||||
@ -103,10 +103,11 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
|
|||||||
@Override
|
@Override
|
||||||
public void handForPlatform(RequestEvent evt, Platform parentPlatform, Element element) {
|
public void handForPlatform(RequestEvent evt, Platform parentPlatform, Element element) {
|
||||||
// 个别平台保活不回复200OK会判定离线
|
// 个别平台保活不回复200OK会判定离线
|
||||||
|
// 回复200 OK
|
||||||
try {
|
try {
|
||||||
responseAck((SIPRequest) evt.getRequest(), Response.OK);
|
responseAckAsync((SIPRequest) evt.getRequest(), Response.OK);
|
||||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
log.error("[命令发送失败] 心跳回复: {}", e.getMessage());
|
log.error("[命令发送失败] 报警通知回复: {}", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import com.genersoft.iot.vmp.gb28181.utils.NumericUtil;
|
|||||||
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
import gov.nist.javax.sip.message.SIPRequest;
|
import gov.nist.javax.sip.message.SIPRequest;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dom4j.DocumentException;
|
import org.dom4j.DocumentException;
|
||||||
import org.dom4j.Element;
|
import org.dom4j.Element;
|
||||||
@ -32,6 +33,7 @@ import static com.genersoft.iot.vmp.gb28181.utils.XmlUtil.getText;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParent implements InitializingBean, IMessageHandler {
|
public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParent implements InitializingBean, IMessageHandler {
|
||||||
|
|
||||||
private final String cmdType = "MobilePosition";
|
private final String cmdType = "MobilePosition";
|
||||||
@ -59,7 +61,7 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen
|
|||||||
taskQueue.offer(new SipMsgInfo(evt, device, rootElement));
|
taskQueue.offer(new SipMsgInfo(evt, device, rootElement));
|
||||||
// 回复200 OK
|
// 回复200 OK
|
||||||
try {
|
try {
|
||||||
responseAck((SIPRequest) evt.getRequest(), Response.OK);
|
responseAckAsync((SIPRequest) evt.getRequest(), Response.OK);
|
||||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
log.error("[命令发送失败] 移动位置通知回复: {}", e.getMessage());
|
log.error("[命令发送失败] 移动位置通知回复: {}", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user