win 10/13
parent
8dd797edcf
commit
f21a96a4f2
|
@ -1 +1 @@
|
|||
23584
|
||||
5052
|
|
@ -1,28 +1,17 @@
|
|||
<?xml version="1.0" encoding="euc-kr"?>
|
||||
<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>
|
||||
<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"/>
|
||||
</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"/>
|
||||
<!-- <Option LineMode="TURE" InOut="RECV" McastGrp="+239.192.0.1" /> -->
|
||||
<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.11.12.5"/> -->
|
||||
<Reconnect ReconnUSE="TRUE" Interval="600"/>
|
||||
</UdpSocket>
|
||||
|
||||
|
||||
</Root>
|
21
pom.xml
21
pom.xml
|
@ -36,6 +36,12 @@
|
|||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -44,6 +50,13 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.30</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- IPWorks -->
|
||||
<dependency>
|
||||
<groupId>ipworks.local</groupId>
|
||||
|
@ -53,6 +66,13 @@
|
|||
<systemPath>${basedir}/lib/ipworks/local/1.0.0/ipworks-local-1.0.0.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<!-- guava - RateLimiter -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>31.1-jre</version>
|
||||
</dependency>
|
||||
|
||||
<!-- data format -->
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
|
@ -71,6 +91,7 @@
|
|||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>EyeGW_AsdeRecv-0.0.1</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
|
@ -92,7 +92,7 @@ public class AsterixParserThread {
|
|||
List<LinkedHashMap<String,String>> result = asterixParser.parse(data, sTime);
|
||||
|
||||
// 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()) {
|
||||
|
||||
|
|
|
@ -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.ServiceHeader;
|
||||
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.http.HttpStatus;
|
||||
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.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.util.concurrent.RateLimiter;
|
||||
|
||||
|
||||
@RestController
|
||||
@Component("AsdeServiceController")
|
||||
public class AsdeServiceController{
|
||||
|
||||
// 프레임 워크 구성요소 //
|
||||
|
@ -54,9 +58,60 @@ public class AsdeServiceController{
|
|||
|
||||
private AsdeServiceVO asdeServiceVO;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@GetMapping(value = "/getASDE/{qid}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public String getASDE( @PathVariable Integer qid) {
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
@GetMapping(value = "/getASDE/{qid}")
|
||||
public ResponseEntity<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 ;
|
||||
ServiceHeader jsonHeader = new ServiceHeader();
|
||||
List<ServiceAsdeData> jsonData = new ArrayList<ServiceAsdeData>();
|
||||
|
@ -66,26 +121,26 @@ public class AsdeServiceController{
|
|||
|
||||
asdeServiceVO = new AsdeServiceVO();
|
||||
|
||||
int idx = qid -1;
|
||||
long qSize = sendQueue.get(idx).size();
|
||||
int qSize = procQue.size();
|
||||
|
||||
if(qSize > 0) serviceRunnig = true ;
|
||||
//if(qSize > 0) serviceRunnig = true ;
|
||||
|
||||
if(qSize > scvDatacount) qSize = scvDatacount;
|
||||
|
||||
if(qid > scvQcount || qid <= 0) {
|
||||
if(queIdx > scvQcount -1 || queIdx < 0) {
|
||||
sendCode = "Err-01";
|
||||
sendMsg = "할당되지 않은 큐를 지정했습니다.";
|
||||
// retList.add(sendMsg);
|
||||
logger.error(sendMsg);
|
||||
}else {
|
||||
if(sendQueue.get(idx).peek() == null) {
|
||||
//if(procQue.peek() == null) {
|
||||
if(procQue.size() <= 0) {
|
||||
sendCode = "200";
|
||||
sendMsg = "전송할 데이터 없음.";
|
||||
// retList.add(sendMsg);
|
||||
// logger.error("procQue size" + " / " + procQue.size());
|
||||
}else{
|
||||
|
||||
while (qSize > 0 ) {
|
||||
jsonData.add(sendQueue.get(idx).poll());
|
||||
jsonData.add(procQue.poll());
|
||||
qSize--;
|
||||
}
|
||||
}
|
||||
|
@ -98,14 +153,27 @@ public class AsdeServiceController{
|
|||
asdeServiceVO.setHeader(jsonHeader);
|
||||
|
||||
if (sendCode.equals("200")) {
|
||||
|
||||
//logger.debug("jsonData : " + jsonData.size() + " / " + 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 sTmp = "";
|
||||
String sRetJsonData = "";
|
||||
try {
|
||||
sTmp = mapper.writeValueAsString(asdeServiceVO);
|
||||
sRetJsonData = mapper.writeValueAsString(asdeServiceVO);
|
||||
} catch (JsonProcessingException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
|
@ -113,11 +181,17 @@ public class AsdeServiceController{
|
|||
|
||||
serviceRunnig = false ;
|
||||
|
||||
return sTmp;
|
||||
// if( !sendMsg.equals("")){
|
||||
// logger.debug("debug :" + sRetJsonData);
|
||||
// }
|
||||
|
||||
return sRetJsonData;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ import java.util.HashMap;
|
|||
import java.util.Queue;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
|
||||
//@Component("controller")
|
||||
@Component("controller")
|
||||
public class MainController implements ApplicationListener<ContextClosedEvent> {
|
||||
|
||||
@Value("${root}")
|
||||
|
@ -160,6 +160,8 @@ public class MainController implements ApplicationListener<ContextClosedEvent> {
|
|||
isRunning = true;
|
||||
udpManager.initializeUDPFromXML();
|
||||
|
||||
serviceQClearThread.start();
|
||||
|
||||
udpManager.startClient();
|
||||
recvQThread.start();
|
||||
sendQThread.start();
|
||||
|
|
|
@ -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.StandMasterVO;
|
||||
|
||||
@Component("restReciveController")
|
||||
//@Component("restReciveController")
|
||||
public class RestReciveController {
|
||||
|
||||
|
||||
|
@ -38,6 +38,8 @@ public class RestReciveController {
|
|||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
|
||||
private AiMetaVideoStatusVO_Sts aiVideo_Sts;
|
||||
private AiMetaVideoStatusVO_Data aiVideo_Data;
|
||||
|
||||
@Autowired
|
||||
private StandMasterService standService;
|
||||
|
@ -51,6 +53,11 @@ public class RestReciveController {
|
|||
this.recvQ = new LinkedBlockingQueue<AImetaTestVO>();
|
||||
|
||||
this.mapStatus = new AiMetaVideoStatusVO();
|
||||
|
||||
// this.aiVideo_Sts = new AiMetaVideoStatusVO_Sts();
|
||||
// this.aiVideo_Data = new AiMetaVideoStatusVO_Data();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Scheduled(fixedRate = 1000) // 1초마다 실행
|
||||
|
@ -104,22 +111,25 @@ public class RestReciveController {
|
|||
String sStandNO = mappingStand(sCctvID);
|
||||
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)));
|
||||
dataMap.setStandNo(sStandNO);
|
||||
dataMap.setSts(sSts);
|
||||
// aiVideo_Data.setRecvTime( String.valueOf(sdf.format(now)));
|
||||
// aiVideo_Data.setStandNo(sStandNO);
|
||||
// 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);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -12,30 +12,12 @@ public class AiMetaVideoStatusVO {
|
|||
|
||||
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
|
||||
@Setter
|
||||
public static class AiMetaVideoStatusVO_Sts {
|
||||
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
Loading…
Reference in New Issue