I did set up a spring Batch job, it runs fine on a single JVM. But I need it to be deployed on to a clustered environemnt. I am using spring task scheduler to schedule the job. Is there any way to do it on clustered environment, if one node is down the other should pick it up. Server to be deployed on is Webspehere.
Asked
Active
Viewed 3,758 times
3
-
1Use a scheduler that is cluster aware like quartz. – M. Deinum Oct 21 '14 at 18:27
-
So if I schedule a job thru Quartz, will it be persistent and switch between nodes? – anu Oct 21 '14 at 19:12
-
1It depends on how you configure quartz you should use stateful jobs (i.e. database persistent) and then a job will run on a single node. If one crashes the next job will be started on the node that is still running. But that also depends on your quartz and batch configuration. – M. Deinum Oct 22 '14 at 05:59
3 Answers
2
Two suggestions:
- Quartz setup in the DB
- Hazelcast via Apache Camel Idempotent repository
Both of these approaches will ensure your task is getting picked up just once.
The first approach requires the (tedious) Quartz DB setup but then you can connect your unclustered Websphere webapps directly.
The second approach doesn't require persistent store and via the Apache Camel wrapper makes the setup a breeze.

dimitrisli
- 20,895
- 12
- 59
- 63
-
I'm trying to use your first approach, with Quartz setup, but have a problem with matching Quartz job and Spring Batch job for this configuration http://stackoverflow.com/questions/32647018/how-should-i-use-tasklet-chunk-to-finish-job-succesfully. Could you suggest some solution? – Dmitry Adonin Sep 22 '15 at 08:55
0
I have finally got it working with EJB persistent timers launching the spring batch job. The transaction type for those EJB timers have defined as Bean Transaction, so it is not container managed. The Websphere scheduler takes care of the clustering with EJB timers. So the spring batch job gets kicked off on only one server at a time.

anu
- 31
- 1
- 2