设备目录查询 key 调整

This commit is contained in:
shikong 2023-10-03 16:38:33 +08:00
parent d3bf7b4056
commit 60ea2fc372
2 changed files with 3 additions and 2 deletions

View File

@ -82,7 +82,7 @@ public class MessageRequestProcessor implements MessageProcessor {
() -> log.warn("对应订阅 {} 已结束, 异常数据 => {}", key, dto)); () -> log.warn("对应订阅 {} 已结束, 异常数据 => {}", key, dto));
}else if(messageDto.getCmdType().equalsIgnoreCase(CmdType.CATALOG)){ }else if(messageDto.getCmdType().equalsIgnoreCase(CmdType.CATALOG)){
CatalogResponseDTO catalogResponseDTO = MANSCDPUtils.parse(content, CatalogResponseDTO.class); CatalogResponseDTO catalogResponseDTO = MANSCDPUtils.parse(content, CatalogResponseDTO.class);
String key = GenericSubscribe.Helper.getKey(catalogResponseDTO.getDeviceId(), catalogResponseDTO.getSn()); String key = GenericSubscribe.Helper.getKey(CmdType.CATALOG,catalogResponseDTO.getDeviceId(), catalogResponseDTO.getSn());
Optional.ofNullable(subscribe.getSipRequestSubscribe().getPublisher(key)).ifPresent(publisher->{ Optional.ofNullable(subscribe.getSipRequestSubscribe().getPublisher(key)).ifPresent(publisher->{
publisher.submit(request); publisher.submit(request);
}); });

View File

@ -1,6 +1,7 @@
package cn.skcks.docking.gb28181.service.catalog; package cn.skcks.docking.gb28181.service.catalog;
import cn.skcks.docking.gb28181.config.sip.SipConfig; import cn.skcks.docking.gb28181.config.sip.SipConfig;
import cn.skcks.docking.gb28181.constant.CmdType;
import cn.skcks.docking.gb28181.core.sip.message.request.SipRequestBuilder; import cn.skcks.docking.gb28181.core.sip.message.request.SipRequestBuilder;
import cn.skcks.docking.gb28181.core.sip.message.subscribe.GenericSubscribe; import cn.skcks.docking.gb28181.core.sip.message.subscribe.GenericSubscribe;
import cn.skcks.docking.gb28181.core.sip.message.subscribe.SipSubscribe; import cn.skcks.docking.gb28181.core.sip.message.subscribe.SipSubscribe;
@ -64,7 +65,7 @@ public class CatalogService {
.sn(sn) .sn(sn)
.build(); .build();
Request request = requestBuilder.createMessageRequest(callId, cSeq, MANSCDPUtils.toByteXml(catalogQueryDTO)); Request request = requestBuilder.createMessageRequest(callId, cSeq, MANSCDPUtils.toByteXml(catalogQueryDTO));
String key = GenericSubscribe.Helper.getKey(gbDeviceId,sn); String key = GenericSubscribe.Helper.getKey(CmdType.CATALOG, gbDeviceId, sn);
subscribe.getSipRequestSubscribe().addPublisher(key, 60, TimeUnit.SECONDS); subscribe.getSipRequestSubscribe().addPublisher(key, 60, TimeUnit.SECONDS);
subscribe.getSipRequestSubscribe().addSubscribe(key, new Flow.Subscriber<>() { subscribe.getSipRequestSubscribe().addSubscribe(key, new Flow.Subscriber<>() {
private Flow.Subscription subscription; private Flow.Subscription subscription;