From 9236419d3cff63ff0b73c7c84ab2412e840a1b73 Mon Sep 17 00:00:00 2001 From: Geonwoo Pack Date: Sun, 19 May 2024 00:06:25 +0900 Subject: [PATCH] =?UTF-8?q?hotfix=20:=20jobParameter=EB=A1=9C=20=EC=8B=9C?= =?UTF-8?q?=EA=B0=84=20=EA=B0=92=EC=9D=84=20=EC=A0=84=EB=8B=AC=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/kusitms/duduk/batch/BatchScheduler.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/batch/src/main/java/kusitms/duduk/batch/BatchScheduler.java b/batch/src/main/java/kusitms/duduk/batch/BatchScheduler.java index 76cb76b..ab358a1 100644 --- a/batch/src/main/java/kusitms/duduk/batch/BatchScheduler.java +++ b/batch/src/main/java/kusitms/duduk/batch/BatchScheduler.java @@ -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; @@ -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); } }