java/배치 & Scheduling

배치 & Scheduling 관련 참조

내가 만드는게 길이 된다 2023. 10. 6. 16:36

//-------------------------------------------------------------------------------------------------//
// 1. 배치 & Scheduling 관련 참조
//-------------------------------------------------------------------------------------------------//

https://adjh54.tistory.com/169
https://adjh54.tistory.com/170

https://it-techtree.tistory.com/entry/creating-a-batchservice-using-springboot
https://start.spring.io/
https://khj93.tistory.com/entry/Spring-Batch%EB%9E%80-%EC%9D%B4%ED%95%B4%ED%95%98%EA%B3%A0-%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0
https://devfunny.tistory.com/688

//-------------------------------------------------------------------------------------------------//
//2. Quartz Scheduling
//-------------------------------------------------------------------------------------------------//
https://wouldyou.tistory.com/94 : Quartz Scheduling

https://data-make.tistory.com/700 : Quartz Scheduling 개발 참조하기 

https://pooney.tistory.com/99
https://developyo.tistory.com/251
//-------------------------------------------------------------------------------------------------//
// 3. Spring scheduler
//-------------------------------------------------------------------------------------------------//

https://wouldyou.tistory.com/114 : Spring scheduler ( @EnabledScheduling, @Scheduled 사용 )

//-------------------------------------------------------------------------------------------------//
// 4. Spring scheduler 적용방법
//-------------------------------------------------------------------------------------------------//
https://gofnrk.tistory.com/33 : @EnableScheduling 적용방법

 

 

[Spring Batch+Quartz] 스프링 배치+쿼츠 설정 및 구현 Clustering 모드 사용

1. Quartz 와 Batch 1-1. Quartz - 언제 실행시킬지와 관련 - Scheduling 1-2. Batch - 무엇을 실행시킬지와 관련 - Batch job - 보통 배치를 짠다는 말은 Batch job 개발을 한다는 의미 2. Quartz와 Batch의 관계 및 함께

developyo.tistory.com

 

//-------------------------------------------------------------------------------------------------//
// 5. Quartz Scheduler + Spring Boot Example
//-------------------------------------------------------------------------------------------------//

https://javabypatel.blogspot.com/2017/10/quartz-scheduler-spring-boot-example.html

 

package com.webnormal.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

@Configuration
@EnableScheduling
public class ScheduledConfig {
	//스프링 부트에서 스케줄러 기능을 사용하기 위해 @EnableScheduling 설정
	
	@Bean
	public TaskScheduler scheduler() {
		ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
		scheduler.setPoolSize(4);
		return scheduler;
	}

}

[참조사이트]
https://gofnrk.tistory.com/33

 

package com.webnormal.batch;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class DemoScheduler {
	private Logger logger = LoggerFactory.getLogger(DemoScheduler.class);
	
	//끝나고 30초 후 시작
	//끝나고 1초 후 시작
	@Scheduled(fixedDelay = 1000 * 1)
	public void alert() {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss");
		Date nowDate = new Date();
		String strDate = sdf.format(nowDate);
		
		logger.info("[Exec >>>>>>>] 현재시간 : {}", strDate);
	}
}

[참조사이트]
https://gofnrk.tistory.com/33