1

I'm working on a spring batch project in which a step has a reader (JDBC Cursor Item Reader), processor, writer, etc... There was an issue where when reading in a chunk there was a momentary issue with the database. More specifically, it threw an exception due to not being able to create a transaction (with "open" method of implemented JDBC Cursor Item Reader).

However, the odd thing is, that instead of failing the step or even the job it simply moved onto the next chunk where it was able to establish a connection and carried on. I'm aware of the skip/retry options (posted below) and will implement for the future. But I'm curious as to whether this is the default behavior or if something else is afoot?

<batch:tasklet>
  <batch:chunk reader="myItemReader" writer="myItemWriter" commit-interval="20" retry-policy="myRetryPolicy"/>
</batch:tasklet>
ThatTechGuy
  • 879
  • 1
  • 10
  • 29
  • Could you show us what you're configuring for retry-policy? – Nghia Do Nov 17 '16 at 16:18
  • Well I'm not currently. I will configure it, but I'm wondering without retry/skip logic what does spring do by default when there's an error opening a transaction for a chunk? – ThatTechGuy Nov 17 '16 at 16:20
  • I see you already have retry-policy from the post. – Nghia Do Nov 17 '16 at 16:23
  • I had mentioned that I was aware of such a policy and was giving an example of it. However, at this time I've not implemented it and am curious as to whether it is an intended behaviour. – ThatTechGuy Nov 17 '16 at 16:52
  • Please post the stack trace – Michael Minella Nov 17 '16 at 17:24
  • Okay I'll have to update that later but actually here is another question on here that IS the EXACT problem and much better explained... – ThatTechGuy Nov 17 '16 at 18:58
  • http://stackoverflow.com/questions/35985815/spring-batch-propagate-exception-encountered-in-partitioned-step-stop-job-exe – ThatTechGuy Nov 17 '16 at 18:59
  • That one and this one are not the same. That one is Partitioner's behavior. – Nghia Do Nov 17 '16 at 21:50
  • Yes we have a partitioner, that's what I was referring to as a chunk... ie individual partitions. I did not know they were each a thread. – ThatTechGuy Nov 18 '16 at 03:16
  • So now, everything clear ? – Nghia Do Nov 18 '16 at 03:51
  • Well not entirely... but I'll update this question to be more clear and include trace. However, the main thing is, how to stop other slaves from executing... can this be done with a listener on exit status to then stop the others? – ThatTechGuy Nov 18 '16 at 05:05

0 Answers0