|
|
|
|
@ -14,10 +14,7 @@ import org.apache.commons.lang3.EnumUtils;
|
|
|
|
|
import org.springframework.http.HttpEntity;
|
|
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
|
|
import org.springframework.http.MediaType;
|
|
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
|
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
|
|
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
|
|
|
|
import org.springframework.scheduling.support.CronTrigger;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.web.client.ResourceAccessException;
|
|
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
@ -27,7 +24,6 @@ import java.io.FileNotFoundException;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.ObjectInputStream;
|
|
|
|
|
import java.time.Duration;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.concurrent.ScheduledFuture;
|
|
|
|
|
@ -35,8 +31,7 @@ import java.util.concurrent.ScheduledFuture;
|
|
|
|
|
@Service
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class DropBoxTaskExecutorService {
|
|
|
|
|
private final ThreadPoolTaskExecutor dropBoxProcessorThreadPoolTaskExecutor;
|
|
|
|
|
public class DropBoxSchedulerService {
|
|
|
|
|
private final ThreadPoolTaskScheduler dropBoxProcessorThreadPoolTaskScheduler;
|
|
|
|
|
private final AgentConfigReader agentConfigReader;
|
|
|
|
|
private final SqlExecuteService sqlExecuteService;
|
|
|
|
|
@ -48,7 +43,6 @@ public class DropBoxTaskExecutorService {
|
|
|
|
|
* @param messageFilePath 메지시 파일 절대 경로
|
|
|
|
|
*/
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
|
// @Async("dropBoxProcessorThreadPoolTaskExecutor")
|
|
|
|
|
public void processDropBox(String messageFilePath) {
|
|
|
|
|
ReceiveMessageDto receiveMessageDto = ReceiveMessageDto.builder().build();
|
|
|
|
|
ReceiveMessageDto.ProcessStatus processStatus;
|
|
|
|
|
@ -176,28 +170,9 @@ public class DropBoxTaskExecutorService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void launch() { // 실행확인됨
|
|
|
|
|
log.debug("{} launch", this.getClass().getName());
|
|
|
|
|
ScheduledFuture<?> scheduledFuture = dropBoxProcessorThreadPoolTaskScheduler.scheduleWithFixedDelay(this::run, Duration.ofMillis(10));
|
|
|
|
|
/*
|
|
|
|
|
Runnable runnable = () -> {
|
|
|
|
|
try {
|
|
|
|
|
log.info("dropBoxProcessThread run {}", Thread.currentThread().getName());
|
|
|
|
|
String messageFilePath = dropBoxService.poll();
|
|
|
|
|
if(StringUtils.isNotBlank(messageFilePath)) {
|
|
|
|
|
this.processDropBox(messageFilePath);
|
|
|
|
|
}
|
|
|
|
|
Thread.sleep(10);
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
log.error("{}", e, e);
|
|
|
|
|
Thread.currentThread().interrupt();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
for(int i = 0; i < this.dropBoxProcessorThreadPoolTaskExecutor.getCorePoolSize(); i++) {
|
|
|
|
|
this.dropBoxProcessorThreadPoolTaskExecutor.execute(runnable);
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|