Announcement Announcement Module
Collapse
No announcement yet.
How can I put some operations between steps? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How can I put some operations between steps?

    How can I put some operations between steps?
    For example, how can I put a process to sleep for a period of time before continuing to the next step.

  • #2
    I can suggest a few ways (there may be more): make a new step, or add a RepeatInterceptor to one of the other steps via the stepOperations, or use step scope for your tasklet and add code to the initializer (eg unit-method). Have a look in the samples for a job using a repeat interceptor.
    Last edited by Dave Syer; Jan 14th, 2008, 02:35 AM. Reason: spelling

    Comment


    • #3
      As Dave points out, there are several ways to accomplish this. To expound a little on one of his suggestions, when you use "step" scoped beans, you gain access to all of the Spring features that wrap the bean's lifecycle, for instance, the "init-method" and "destroy-method" attributes of the <bean> tag. Alternatively, you can declare your beans as InitializingBean or DisposableBean and handle your needs that way. Similarly, you can use the RepeatInterceptor pattern.

      This is very useful for cleaning up connections or open files (or gathering custom metadata / performing extra logging in the case of the repeat interceptor), but I would not recommend using this for business logic. I submitted an issue to address this, please comment on it if you have any suggestions.

      See: http://jira.springframework.org/browse/BATCH-151

      Comment

      Working...
      X