Skip to content

Commit

Permalink
hotfix : jobParameter로 시간 값을 전달한다
Browse files Browse the repository at this point in the history
  • Loading branch information
packdev937 committed May 18, 2024
1 parent 20fe79f commit 9236419
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions batch/src/main/java/kusitms/duduk/batch/BatchScheduler.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.batch.core.JobParametersInvalidException;
import org.springframework.batch.core.launch.JobLauncher;
Expand All @@ -26,9 +27,14 @@ public class BatchScheduler {
//@Scheduled(fixedRate = 5000)
//@Scheduled(cron = "0 */1 * * *")
@Scheduled(cron = "1 * * * * *")
public void scheduledTask() throws JobInstanceAlreadyCompleteException, JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
public void scheduledTask()
throws JobInstanceAlreadyCompleteException, JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
log.info("News letter batch service started");

jobLauncher.run(generateNewsLetterJob, new JobParametersBuilder().toJobParameters());
JobParameters jobParameters = new JobParametersBuilder()
.addLong("time", System.currentTimeMillis())
.toJobParameters();

jobLauncher.run(generateNewsLetterJob, jobParameters);
}
}

0 comments on commit 9236419

Please sign in to comment.