Skip to content

Commit 40d219e

Browse files
refactoring
1 parent 345f4a1 commit 40d219e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

skeletonBatch/src/main/java/com/example/batch/job/SampleJob.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public class SampleJob {
2323

2424
@Bean
2525
public Job createSampleJob() {
26+
log.info("----------- Registering job: sample -----------");
2627

2728
// Create a step for processing
2829
Step myStep =
@@ -31,8 +32,13 @@ public Job createSampleJob() {
3132
.build();
3233

3334
// Build and return the job
34-
return new JobBuilder("sample-job", jobRepository)
35+
Job myJob =
36+
new JobBuilder("sample-job", jobRepository)
3537
.start(myStep)
3638
.build();
39+
40+
log.info("----------- Job registered successfully: {} -----------", myJob.getName());
41+
42+
return myJob;
3743
}
3844
}

skeletonBatch/src/main/java/com/example/batch/logic/SampleLogic.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class SampleLogic implements Tasklet {
1818
@Override
1919
public RepeatStatus execute(StepContribution contribution,
2020
ChunkContext chunkContext) throws Exception {
21+
log.info("----------- START ----------- Batch Processing -----------");
2122

2223
try {
2324
// Execute business logic
@@ -28,6 +29,7 @@ public RepeatStatus execute(StepContribution contribution,
2829
throw e;
2930
}
3031

32+
log.info("----------- END ----------- Batch Processing -----------");
3133
return RepeatStatus.FINISHED;
3234
}
3335
}

0 commit comments

Comments
 (0)