Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <batch:job id="job.download-stuff" restartable="true">
- <batch:validator ref="downloadValidator"/>
- <batch:step id="job.download-stuff.download">
- <batch:tasklet ref="salesChannelOrderDownloader" transaction-manager="transactionManager">
- <batch:transaction-attributes isolation="READ_UNCOMMITTED" propagation="NOT_SUPPORTED"/>
- <batch:listeners>
- <batch:listener ref="downloadListener"/>
- <batch:listener ref="loggingContextStepListener" />
- </batch:listeners>
- </batch:tasklet>
- <batch:next on="CONTINUE" to="job.download-stuff.process-stuff.step" />
- <batch:end on="*" />
- </batch:step>
- <batch:step id="job.download-stuff.process-stuff.step">
- ...
- </batch:step>
- <batch:listeners>
- <batch:listener ref="loggingContextJobListener"/>
- </batch:listeners>
- @Override
- @Transactional(propagation = Propagation.REQUIRES_NEW)
- public ExitStatus afterStep(StepExecution stepExecution) {
- long runSeconds = TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - nanoStart);
- // If Success - we're good
- if (stepExecution.getStatus() == BatchStatus.COMPLETED) {
- Long endTs = stepExecution.getExecutionContext().getLong("toTime");
- Date toTime = new Date(endTs);
- handleSuccess(toTime, stepExecution.getWriteCount());
- return null;
- }
- // Otherwise - record errors
- List<Throwable> failures = stepExecution.getFailureExceptions();
- handleError(failures);
- return ExitStatus.FAILED;
- }
- <batch:next on="CONTINUE" to="job.download-stuff.process-stuff.step" />
- <batch:end on="*" />
- <!-- nothing to me indicates you'd get CONTINUE here, so I changed it -->
- <batch:next on="COMPLETED" to="job.download-stuff.process-stuff.step" />
- <!-- if you ever have reason to stop here -->
- <batch:end on="END" />
- <!-- always fail on anything unexpected -->
- <batch:fail on="*" />
Add Comment
Please, Sign In to add comment