首页 > 解决方案 > Running a spring batch with partitions in cloud foundry

问题描述

I have created an app with spring batch(with partition) application taking example of this https://github.com/mminella/S3JDBC. My app is reading some files from object store and doing some processing and writing back to object the store. My app with local partition works fine in my machine.

I changed the maven, to run in cloud foundry , did change for deployer partition handler and step execution listener and deploying on pcf.

But while trying to push and run the app on pcf , I am getting an issue : Failing URI /v2/info. I tried to log the error found that there is one call to my app e.g https://mypcf.com:443/v2/info and after that it gives the error. I cant provide full logs because of some restrictions. So I want to know :

  1. To deploy a spring batch in pcf(is there any extra configuration needed except the maven dependency and code changes for deployerpartitionhandler and stepexecutionlistener and @cloudtask): org.springframework.cloud spring-cloud-deployer-cloudfoundry 1.1.0.M1
  2. Is it mandatory to have a separate data base service like my-sql for the partition job. Cant I use H2(the default one, if I don't configure anything)?
  3. Do I need to do any configuration in pcf to support running multiple partitions ?
  4. As I am running remote partitioning , can I run that app on local STS or Intellij(not on PCF-DEV)so that it will run my app in pcf(remote) and launch the workers.(Sorry for the stupid question , I am new to PCF).

标签: spring-batchspring-cloud-taskpcf

解决方案


感谢您查看我的示例。要回答您的问题:

  1. 您应该能够使用最新的部署器版本(而不是那个相当旧的版本)。
  2. 是的。分区步骤都需要能够共享相同的作业存储库数据存储,因此像 H2 这样的内存数据库不适用于该用例。
  3. 除了定义您的数据源之外,这就是在 PCF 中所需要的全部内容。话虽如此,还有其他需要配置的东西,但您可以使用其他机制来执行此操作(Spring Cloud Config Server、application.properties/yml 等)。
  4. 是的,如果您使用 CF 部署程序,您应该能够在本地运行主服务器并将工作人员部署到 PCF 上。

推荐阅读