title: spring batch sleep between steps
body: <p>How can I make a spring batch job sleep between executions if the next step is itself?</p>
  
  <p>For example </p>
  
  <pre><code>&lt;batch:step id="messages" next="messages"&gt;
  .....
  &lt;/batch:step&gt;
  </code></pre>
  
  <p>I have tried using the parent="simpleJob" with the following configuration only to get unique key constraints. Not sure what I am missing.</p>
  
  <pre><code>&lt;bean id="simpleJob" class="org.springframework.batch.core.job.SimpleJob" abstract="true"&gt;
      &lt;property name="jobRepository" ref="jobRepository"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="runScheduler" class="com.test.boa.scheduler.RunScheduler"&gt;
      &lt;property name="dataSource" ref="dataSource"/&gt;
  &lt;/bean&gt;
  
  &lt;task:scheduled-tasks&gt;
      &lt;task:scheduled ref="runScheduler" method="run" fixed-delay="500000"/&gt;
  &lt;/task:scheduled-tasks&gt; 
  </code></pre>
  
  <p>The runScheduler is getting the next key but it seems like that doesn't get incremented upon step completion.</p>
  
  <p>Any help would be appreciated.</p>