Skip to content

Commit

Permalink
Deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
seheonnn authored Jul 5, 2024
2 parents f3d67bd + efada7c commit c35427f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,23 @@ public Step expectedWeatherStep() {
public Tasklet expectedWeatherTasklet() {
return new ExpectedWeatherTasklet(weatherService);
}

@Bean
public Job weatherAdvisoryJob() {
return new JobBuilder("weatherAdvisoryJob", jobRepository)
.start(weatherAdvisoryStep())
.build();
}

@Bean
public Step weatherAdvisoryStep() {
return new StepBuilder("weatherAdvisoryStep", jobRepository)
.tasklet(weatherAdvisoryTasklet(), transactionManager)
.build();
}

@Bean
public Tasklet weatherAdvisoryTasklet() {
return new WeatherAdvisoryTasklet(weatherService);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class BatchScheduler {
private final JobLauncher jobLauncher;
private final Job dailyWeatherJob;
private final Job expectedWeatherJob;
private final Job weatherAdvisoryTasklet;
private final Job weatherAdvisoryJob;

@Scheduled(cron = "0 0 2,5,8,11,14,17,20,23 * * *") // 3시간마다
public void runDailyWeatherJob() {
Expand Down Expand Up @@ -59,7 +59,7 @@ public void runWeatherAdvisoryJob() {
.addLong("executedTime", System.currentTimeMillis())
.toJobParameters();

jobLauncher.run(weatherAdvisoryTasklet, jobParameters);
jobLauncher.run(weatherAdvisoryJob, jobParameters);
} catch (JobExecutionException e) {
log.error("Error executing expectedWeatherJob: ", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public void produceMessage(String topic, Object message) {

kafkaTemplate.send(topic, message);

CompletableFuture<SendResult<String, Object>> future = kafkaTemplate.send(topic, "weather-key", message);
CompletableFuture<SendResult<String, Object>> future = kafkaTemplate.send(topic, message);

future.whenComplete(((result, throwable) -> {
if (throwable == null) {
Expand Down

0 comments on commit c35427f

Please sign in to comment.