win 10/13

main
MonHun 2023-10-13 18:00:17 +09:00
parent 8dd797edcf
commit f21a96a4f2
10 changed files with 144 additions and 113 deletions

View File

@ -1 +1 @@
23584 5052

View File

@ -1,28 +1,17 @@
<?xml version="1.0" encoding="euc-kr"?> <?xml version="1.0" encoding="euc-kr"?>
<Root Updated="2015-02-05 12:39:27"> <Root Updated="2015-02-05 12:39:27">
<!-- <UdpSocket>
<Connection ID="0" Tag="1" USE="false" Name="udp_recv_test_2284" PIP="127.0.0.1" SIP="127.0.0.1" PORT="55304"/>
<Option LineMode="TURE" InOut="RECV" McastGrp="+239.192.201.7" />
<Reconnect ReconnUSE="TRUE" Interval="600"/>
</UdpSocket>
<UdpSocket>
<Connection ID="1" Tag="2" USE="false" Name="udp_recv_test_3384" PIP="127.0.0.1" SIP="127.0.0.1" PORT="52114"/>
<Option LineMode="TURE" InOut="RECV" McastGrp="+239.11.12.5" />
<Reconnect ReconnUSE="TRUE" Interval="600"/>
</UdpSocket> -->
<UdpSocket> <UdpSocket>
<Connection ID="0" Tag="1" USE="true" Name="udp_recv_test_2284" PIP="127.0.0.1" SIP="127.0.0.1" PORT="55304"/> <Connection ID="0" Tag="1" USE="true" Name="udp_recv_test_2284" PIP="127.0.0.1" SIP="127.0.0.1" PORT="55304"/>
<!-- <Option LineMode="TURE" InOut="RECV" McastGrp="+239.192.0.1" /> --> <!-- <Option LineMode="TURE" InOut="recv" McastGrp="+239.192.201.7"/> -->
<Reconnect ReconnUSE="TRUE" Interval="600"/> <Reconnect ReconnUSE="TRUE" Interval="600"/>
</UdpSocket> </UdpSocket>
<UdpSocket> <UdpSocket>
<Connection ID="1" Tag="2" USE="true" Name="udp_recv_test_3384" PIP="127.0.0.1" SIP="127.0.0.1" PORT="52114"/> <Connection ID="1" Tag="2" USE="true" Name="udp_rec239.11.12.5v_test_3384" PIP="127.0.0.1" SIP="127.0.0.1" PORT="52114"/>
<!-- <Option LineMode="TURE" InOut="RECV" McastGrp="+239.192.0.1" /> --> <!-- <Option LineMode="TURE" InOut="recv" McastGrp="+239.11.12.5"/> -->
<Reconnect ReconnUSE="TRUE" Interval="600"/> <Reconnect ReconnUSE="TRUE" Interval="600"/>
</UdpSocket> </UdpSocket>
</Root> </Root>

21
pom.xml
View File

@ -36,6 +36,12 @@
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
@ -44,6 +50,13 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>
<!-- IPWorks --> <!-- IPWorks -->
<dependency> <dependency>
<groupId>ipworks.local</groupId> <groupId>ipworks.local</groupId>
@ -53,6 +66,13 @@
<systemPath>${basedir}/lib/ipworks/local/1.0.0/ipworks-local-1.0.0.jar</systemPath> <systemPath>${basedir}/lib/ipworks/local/1.0.0/ipworks-local-1.0.0.jar</systemPath>
</dependency> </dependency>
<!-- guava - RateLimiter -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version>
</dependency>
<!-- data format --> <!-- data format -->
<dependency> <dependency>
<groupId>org.yaml</groupId> <groupId>org.yaml</groupId>
@ -71,6 +91,7 @@
</dependencies> </dependencies>
<build> <build>
<finalName>EyeGW_AsdeRecv-0.0.1</finalName>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>

View File

@ -92,7 +92,7 @@ public class AsterixParserThread {
List<LinkedHashMap<String,String>> result = asterixParser.parse(data, sTime); List<LinkedHashMap<String,String>> result = asterixParser.parse(data, sTime);
// logger.info("[ASDE분석결과:"+LocalDateTime.now().format(dfPattern)+"] result = "+ result); // logger.info("[ASDE분석결과:"+LocalDateTime.now().format(dfPattern)+"] result = "+ result);
logger.info("[ASDE분석결과(service):"+LocalDateTime.now().format(dfPattern)+"] serviceMap = "+ Arrays.deepToString(serviceMap.toArray())); //logger.info("[ASDE분석결과(service):"+LocalDateTime.now().format(dfPattern)+"] serviceMap = "+ Arrays.deepToString(serviceMap.toArray()));
if(!serviceMap.isEmpty()) { if(!serviceMap.isEmpty()) {

View File

@ -9,20 +9,24 @@ import kr.gmtc.gw.dev.asderecv.asde.rest.vo.AsdeServiceVO;
import kr.gmtc.gw.dev.asderecv.asde.rest.vo.ServiceAsdeData; import kr.gmtc.gw.dev.asderecv.asde.rest.vo.ServiceAsdeData;
import kr.gmtc.gw.dev.asderecv.asde.rest.vo.ServiceHeader; import kr.gmtc.gw.dev.asderecv.asde.rest.vo.ServiceHeader;
import kr.gmtc.gw.dev.asderecv.config.ServiceConfig; import kr.gmtc.gw.dev.asderecv.config.ServiceConfig;
import kr.gmtc.gw.dev.asderecv.controller.MainController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.stereotype.Component; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.util.concurrent.RateLimiter;
@RestController @RestController
@Component("AsdeServiceController")
public class AsdeServiceController{ public class AsdeServiceController{
// 프레임 워크 구성요소 // // 프레임 워크 구성요소 //
@ -53,10 +57,61 @@ public class AsdeServiceController{
private Integer scvDatacount; private Integer scvDatacount;
private AsdeServiceVO asdeServiceVO; private AsdeServiceVO asdeServiceVO;
private static RateLimiter rateLimiter;
protected Logger logger;
protected ObjectMapper mapper;
public AsdeServiceController() {
logger = LoggerFactory.getLogger(this.getClass());
mapper = new ObjectMapper();
// 0.33.. 초에 한 번만 호출 가능
rateLimiter = RateLimiter.create(3);
}
@SuppressWarnings("deprecation") @GetMapping(value = "/getASDE/{qid}")
@GetMapping(value = "/getASDE/{qid}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public ResponseEntity<String> getASDE( @PathVariable Integer qid) {
public String getASDE( @PathVariable Integer qid) {
int qidx = qid -1;
String sRetJsonData = "";
if(!serviceRunnig) {
}
// if (rateLimiter.tryAcquire()) {
// sRetJsonData = makeServiceData(qidx, sendQueue.get(qidx));
// logger.debug("make json data END.");
// return ResponseEntity.ok(sRetJsonData);
// }else{
// sRetJsonData = "처리중 요청함";
// }
sRetJsonData = makeServiceData(qidx, sendQueue.get(qidx));
// logger.debug("make json data END.");
return ResponseEntity.ok(sRetJsonData);
// 호출할 수 없다면 429 리턴
// return ResponseEntity.status(HttpStatus.TOO_MANY_REQUESTS).build();
// return ResponseEntity.ok(sRetJsonData);
}
private String makeServiceData(int queIdx, Queue<ServiceAsdeData> procQue){
serviceRunnig = true;
String sendCode, sendMsg ; String sendCode, sendMsg ;
ServiceHeader jsonHeader = new ServiceHeader(); ServiceHeader jsonHeader = new ServiceHeader();
List<ServiceAsdeData> jsonData = new ArrayList<ServiceAsdeData>(); List<ServiceAsdeData> jsonData = new ArrayList<ServiceAsdeData>();
@ -66,26 +121,26 @@ public class AsdeServiceController{
asdeServiceVO = new AsdeServiceVO(); asdeServiceVO = new AsdeServiceVO();
int idx = qid -1; int qSize = procQue.size();
long qSize = sendQueue.get(idx).size();
//if(qSize > 0) serviceRunnig = true ;
if(qSize > 0) serviceRunnig = true ;
if(qSize > scvDatacount) qSize = scvDatacount; if(qSize > scvDatacount) qSize = scvDatacount;
if(qid > scvQcount || qid <= 0) { if(queIdx > scvQcount -1 || queIdx < 0) {
sendCode = "Err-01"; sendCode = "Err-01";
sendMsg = "할당되지 않은 큐를 지정했습니다."; sendMsg = "할당되지 않은 큐를 지정했습니다.";
// retList.add(sendMsg); logger.error(sendMsg);
}else { }else {
if(sendQueue.get(idx).peek() == null) { //if(procQue.peek() == null) {
if(procQue.size() <= 0) {
sendCode = "200"; sendCode = "200";
sendMsg = "전송할 데이터 없음."; sendMsg = "전송할 데이터 없음.";
// retList.add(sendMsg); // logger.error("procQue size" + " / " + procQue.size());
}else{ }else{
while (qSize > 0 ) { while (qSize > 0 ) {
jsonData.add(sendQueue.get(idx).poll()); jsonData.add(procQue.poll());
qSize--; qSize--;
} }
} }
@ -98,14 +153,27 @@ public class AsdeServiceController{
asdeServiceVO.setHeader(jsonHeader); asdeServiceVO.setHeader(jsonHeader);
if (sendCode.equals("200")) { if (sendCode.equals("200")) {
//logger.debug("jsonData : " + jsonData.size() + " / " + jsonData);
asdeServiceVO.setData(jsonData); asdeServiceVO.setData(jsonData);
if(jsonData.size() > 0){
logger.debug("jsonData : " + jsonData.size());
}
// asdeServiceVO.setData(jsonData);
// }else{
// logger.debug("////////////////////////////////////////////////////////////////////////////////////////////////jsonData : " + jsonData.size());
// asdeServiceVO.setData(new ArrayList<>());
// //jsonData.add("jsonData : " + jsonData.size());
// }
} }
ObjectMapper mapper = new ObjectMapper(); String sRetJsonData = "";
String sTmp = "";
try { try {
sTmp = mapper.writeValueAsString(asdeServiceVO); sRetJsonData = mapper.writeValueAsString(asdeServiceVO);
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
@ -113,11 +181,17 @@ public class AsdeServiceController{
serviceRunnig = false ; serviceRunnig = false ;
return sTmp; // if( !sendMsg.equals("")){
// logger.debug("debug :" + sRetJsonData);
// }
return sRetJsonData;
} }
} }

View File

@ -27,7 +27,7 @@ import java.util.HashMap;
import java.util.Queue; import java.util.Queue;
import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ArrayBlockingQueue;
//@Component("controller") @Component("controller")
public class MainController implements ApplicationListener<ContextClosedEvent> { public class MainController implements ApplicationListener<ContextClosedEvent> {
@Value("${root}") @Value("${root}")
@ -159,6 +159,8 @@ public class MainController implements ApplicationListener<ContextClosedEvent> {
public void start() { public void start() {
isRunning = true; isRunning = true;
udpManager.initializeUDPFromXML(); udpManager.initializeUDPFromXML();
serviceQClearThread.start();
udpManager.startClient(); udpManager.startClient();
recvQThread.start(); recvQThread.start();

View File

@ -24,7 +24,7 @@ import kr.gmtc.gw.dev.restdev.vo.AiMetaVideoStatusVO.AiMetaVideoStatusVO_Data;
import kr.gmtc.gw.dev.restdev.vo.AiMetaVideoStatusVO.AiMetaVideoStatusVO_Sts; import kr.gmtc.gw.dev.restdev.vo.AiMetaVideoStatusVO.AiMetaVideoStatusVO_Sts;
import kr.gmtc.gw.dev.restdev.vo.StandMasterVO; import kr.gmtc.gw.dev.restdev.vo.StandMasterVO;
@Component("restReciveController") //@Component("restReciveController")
public class RestReciveController { public class RestReciveController {
@ -38,6 +38,8 @@ public class RestReciveController {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
private AiMetaVideoStatusVO_Sts aiVideo_Sts;
private AiMetaVideoStatusVO_Data aiVideo_Data;
@Autowired @Autowired
private StandMasterService standService; private StandMasterService standService;
@ -51,6 +53,11 @@ public class RestReciveController {
this.recvQ = new LinkedBlockingQueue<AImetaTestVO>(); this.recvQ = new LinkedBlockingQueue<AImetaTestVO>();
this.mapStatus = new AiMetaVideoStatusVO(); this.mapStatus = new AiMetaVideoStatusVO();
// this.aiVideo_Sts = new AiMetaVideoStatusVO_Sts();
// this.aiVideo_Data = new AiMetaVideoStatusVO_Data();
} }
@Scheduled(fixedRate = 1000) // 1초마다 실행 @Scheduled(fixedRate = 1000) // 1초마다 실행
@ -104,22 +111,25 @@ public class RestReciveController {
String sStandNO = mappingStand(sCctvID); String sStandNO = mappingStand(sCctvID);
String sSts = recvDatas.get(idx).getStts_cls(); String sSts = recvDatas.get(idx).getStts_cls();
AiMetaVideoStatusVO_Sts stsMap = mapStatus.getStsMap(sStandNO);
AiMetaVideoStatusVO_Data dataMap = mapStatus.getStsMap(sStandNO).getDataMap(sSts); // AiMetaVideoStatusVO_Sts stsMap = mapStatus.getStsMap(sStandNO);
Map<String, AiMetaVideoStatusVO_Sts> standStsMap = new HashMap<String, AiMetaVideoStatusVO_Sts>(); // AiMetaVideoStatusVO_Data dataMap = mapStatus.getStsMap(sStandNO).getDataMap(sSts);
// Map<String, AiMetaVideoStatusVO_Sts> standStsMap = new HashMap<String, AiMetaVideoStatusVO_Sts>();
Date now = new Date(); // Date now = new Date();
dataMap.setRecvTime( String.valueOf(sdf.format(now))); // aiVideo_Data.setRecvTime( String.valueOf(sdf.format(now)));
dataMap.setStandNo(sStandNO); // aiVideo_Data.setStandNo(sStandNO);
dataMap.setSts(sSts); // aiVideo_Data.setSts(sSts);
standStsMap.put(sStandNO, stsMap); // aiVideo_Sts.setMapStatusGroup(new HashMap<String, AiMetaVideoStatusVO_Data>().put(sSts, aiVideo_Data) );
mapStatus.setMapStandNoGroup(standStsMap); // aiVideo_Sts.put(sStandNO, aiVideo_Data);
// mapStatus.setMapStandNoGroup(standStsMap);
} }

View File

@ -12,30 +12,12 @@ public class AiMetaVideoStatusVO {
private Map<String, AiMetaVideoStatusVO_Sts> mapStandNoGroup; private Map<String, AiMetaVideoStatusVO_Sts> mapStandNoGroup;
public AiMetaVideoStatusVO(){
mapStandNoGroup = new HashMap<String, AiMetaVideoStatusVO_Sts>();
}
public AiMetaVideoStatusVO_Sts getStsMap(String sStandNo){
return mapStandNoGroup.get(sStandNo);
}
@Getter @Getter
@Setter @Setter
public static class AiMetaVideoStatusVO_Sts { public static class AiMetaVideoStatusVO_Sts {
private Map<String, AiMetaVideoStatusVO_Data> mapStatusGroup; private Map<String, AiMetaVideoStatusVO_Data> mapStatusGroup;
public AiMetaVideoStatusVO_Sts(String sSts, AiMetaVideoStatusVO_Data map){
mapStatusGroup = new HashMap<String, AiMetaVideoStatusVO_Data>();
}
public AiMetaVideoStatusVO_Data getDataMap(String sSts){
return mapStatusGroup.get(sSts);
}
} }
@Getter @Getter

View File

@ -1,47 +0,0 @@
spring:
profiles:
active: default
group:
default:
- winTest
---
spring:
config:
activate:
on-profile: default
server:
port: 18082
asde:
service:
queueCount: 3
serviceCount: 3000
clearQ:
maxCount: 10000 # 1만건
diffTime: 10000 # 10 sec
clearTime: 300000 # milli-Sec, 5분
filepath1: ${root}/sendTest/Asterix010.txt
filepath2: ${root}/sendTest/Asterix011.txt
---
spring:
config:
activate:
on-profile: real
root: /home/gmt/app/EyeGW_AsdeRecv
---
spring:
config:
activate:
on-profile: winTest
root: D:\Workspace\Odroid_repository\EyeGW_CompDev
request:
url:
recvTest: http://localhost:18082/getVideoTest