Guest User

Untitled

a guest
Nov 17th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. <batch:job id="job.download-stuff" restartable="true">
  2. <batch:validator ref="downloadValidator"/>
  3. <batch:step id="job.download-stuff.download">
  4. <batch:tasklet ref="salesChannelOrderDownloader" transaction-manager="transactionManager">
  5. <batch:transaction-attributes isolation="READ_UNCOMMITTED" propagation="NOT_SUPPORTED"/>
  6. <batch:listeners>
  7. <batch:listener ref="downloadListener"/>
  8. <batch:listener ref="loggingContextStepListener" />
  9. </batch:listeners>
  10. </batch:tasklet>
  11. <batch:next on="CONTINUE" to="job.download-stuff.process-stuff.step" />
  12. <batch:end on="*" />
  13. </batch:step>
  14. <batch:step id="job.download-stuff.process-stuff.step">
  15. ...
  16. </batch:step>
  17. <batch:listeners>
  18. <batch:listener ref="loggingContextJobListener"/>
  19. </batch:listeners>
  20.  
  21. @Override
  22. @Transactional(propagation = Propagation.REQUIRES_NEW)
  23. public ExitStatus afterStep(StepExecution stepExecution) {
  24. long runSeconds = TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - nanoStart);
  25.  
  26. // If Success - we're good
  27. if (stepExecution.getStatus() == BatchStatus.COMPLETED) {
  28. Long endTs = stepExecution.getExecutionContext().getLong("toTime");
  29. Date toTime = new Date(endTs);
  30. handleSuccess(toTime, stepExecution.getWriteCount());
  31. return null;
  32. }
  33.  
  34. // Otherwise - record errors
  35. List<Throwable> failures = stepExecution.getFailureExceptions();
  36. handleError(failures);
  37. return ExitStatus.FAILED;
  38. }
  39.  
  40. <batch:next on="CONTINUE" to="job.download-stuff.process-stuff.step" />
  41. <batch:end on="*" />
  42.  
  43. <!-- nothing to me indicates you'd get CONTINUE here, so I changed it -->
  44. <batch:next on="COMPLETED" to="job.download-stuff.process-stuff.step" />
  45.  
  46. <!-- if you ever have reason to stop here -->
  47. <batch:end on="END" />
  48.  
  49. <!-- always fail on anything unexpected -->
  50. <batch:fail on="*" />
Add Comment
Please, Sign In to add comment