Spring Batch on Clustered environment - Websphere

两盒软妹~` 提交于 2019-12-02 02:30:37

问题


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.


回答1:


SpringBatch does not support any means of clustered executions. If you want your tasks to be clustered you should check products for it, I can suggest you to have look at hazelcast.




回答2:


Two suggestions:

  1. Quartz setup in the DB
  2. 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.




回答3:


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.



来源:https://stackoverflow.com/questions/26492788/spring-batch-on-clustered-environment-websphere

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!