-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
149 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Exécuter MongoDB Container | ||
docker run -d -p 27017:27017 \ | ||
--name test-mongo \ | ||
-v mongo-data:/data/db \ | ||
-e MONGODB_INITDB_ROOT_USERNAME=admin \ | ||
-e MONGODB_INITDB_ROOT_PASSWORD=pass \ | ||
-e MONGODB_INITDB_DATABASE=spring_batch_excel_mongodb_db \ | ||
mongo:latest | ||
|
||
|
||
# Exécuter MongoDB Express Container | ||
docker run --link test-mongo:mongo \ | ||
-p 8222:8222 \ | ||
-e ME_CONFIG_MONGODB_URL="mongodb://mongo:27017" \ | ||
-e PORT=8222 \ | ||
mongo-express | ||
|
||
# "Utilisateur MongoDB Express: admin" | ||
# "Mot de passe MongoDB Express: pass" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 11 additions & 13 deletions
24
src/main/java/com/springbatch/excel/tutorial/batch/listeners/JobCompletionListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,38 @@ | ||
package com.springbatch.excel.tutorial.batch.listeners; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.batch.core.BatchStatus; | ||
import org.springframework.batch.core.JobExecution; | ||
import org.springframework.batch.core.listener.JobExecutionListenerSupport; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.Date; | ||
|
||
@Slf4j | ||
@Component | ||
public class JobCompletionListener extends JobExecutionListenerSupport { | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(JobCompletionListener.class); | ||
|
||
@Override | ||
public void afterJob(JobExecution jobExecution) { | ||
|
||
String jobId = jobExecution.getJobParameters().getString("jobId"); | ||
String excelFilePath = jobExecution.getJobParameters().getString("excelPath"); | ||
|
||
// get job's start time | ||
// get job's start time | ||
Date start = jobExecution.getCreateTime(); | ||
// get job's end time | ||
Date end = jobExecution.getEndTime(); | ||
|
||
if(jobExecution.getStatus() == BatchStatus.COMPLETED) { | ||
if (jobExecution.getStatus() == BatchStatus.COMPLETED) { | ||
|
||
LOGGER.info("==========JOB FINISHED======="); | ||
LOGGER.info("JobId : {}",jobId); | ||
LOGGER.info("excel Path : {}",excelFilePath); | ||
LOGGER.info("Start Date: {}", start); | ||
LOGGER.info("End Date: {}", end); | ||
LOGGER.info("=============================="); | ||
log.info("==========JOB FINISHED======="); | ||
log.info("JobId : {}", jobId); | ||
log.info("excel Path : {}", excelFilePath); | ||
log.info("Start Date: {}", start); | ||
log.info("End Date: {}", end); | ||
log.info("=============================="); | ||
} | ||
|
||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.