|
|
|
|
@ -9,6 +9,7 @@ import com.bsmlab.dfx.agent.support.MessageUtils;
|
|
|
|
|
import com.bsmlab.dfx.agent.support.exception.IllegalMessageException;
|
|
|
|
|
import com.bsmlab.dfx.agent.support.exception.InCompleteMessageException;
|
|
|
|
|
import com.bsmlab.dfx.agent.support.exception.NullMessageException;
|
|
|
|
|
import com.bsmlab.dfx.agent.task.dropbox.DropBoxSchedulerService;
|
|
|
|
|
import com.bsmlab.dfx.agent.task.dropbox.DropBoxService;
|
|
|
|
|
import com.bsmlab.dfx.agent.task.postman.PostmanSchedulerService;
|
|
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
|
|
@ -36,6 +37,7 @@ import java.util.Iterator;
|
|
|
|
|
@Service
|
|
|
|
|
public class ListenerService {
|
|
|
|
|
private final DropBoxService dropBoxService;
|
|
|
|
|
private final DropBoxSchedulerService dropBoxSchedulerService;
|
|
|
|
|
private final AgentConfigReader agentConfigReader;
|
|
|
|
|
private final PostmanSchedulerService postmanSchedulerService;
|
|
|
|
|
|
|
|
|
|
@ -155,10 +157,10 @@ public class ListenerService {
|
|
|
|
|
try {
|
|
|
|
|
commandDto = MessageUtils.toCommandDto(messageJsonString);
|
|
|
|
|
String resultText = null;
|
|
|
|
|
if(CommandDto.CommandType.ALIVE == commandDto.getCommandType()) {
|
|
|
|
|
if(CommandDto.CommandType.ALIVE == commandDto.getCommandType()) { // ALIVE 메시지인 경우 "ALIVE" 문자열 반송
|
|
|
|
|
resultText = "ALIVE";
|
|
|
|
|
}
|
|
|
|
|
else if(CommandDto.CommandType.INFORMATION == commandDto.getCommandType()) {
|
|
|
|
|
else if(CommandDto.CommandType.INFORMATION == commandDto.getCommandType()) { // INFORMATION 메시지인 경우 AgentConfigDto의 인스턴스 내용을 반송
|
|
|
|
|
AgentConfigDto agentConfigDto = this.agentConfigReader.getAgentConfigDto();
|
|
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
|
|
try {
|
|
|
|
|
@ -167,6 +169,16 @@ public class ListenerService {
|
|
|
|
|
resultText = "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(CommandDto.CommandType.SAVE_CONFIG == commandDto.getCommandType()) { // SAVE_CONFIG 메시지인 경우 수신 데이터를 AgentConfigDto로 변환
|
|
|
|
|
//TODO 1. Postman, Dropbox 쓰레드 정지
|
|
|
|
|
this.postmanSchedulerService.stopAll();
|
|
|
|
|
this.dropBoxSchedulerService.stopAll();
|
|
|
|
|
//TODO 2. AgentConfigDto 갱신 및 settings.json으로 저장
|
|
|
|
|
//TODO 3. Postman, Dropbox 쓰래드 시작
|
|
|
|
|
this.dropBoxSchedulerService.launch();
|
|
|
|
|
this.postmanSchedulerService.launch();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
ackDto = AckDto.builder().result(AckDto.ResultType.PROCESS_SUCCESS).messageUuid(commandDto.getMessageUuid()).resultText(resultText).build();
|
|
|
|
|
}
|
|
|
|
|
catch (IllegalMessageException | NullMessageException e) {
|
|
|
|
|
|