Our application is built using Spring boot + Gradle. We have got a new requirement to implement spring batch job and it will be triggered using autosys(job scheduling tool) and it has 3 steps performing 3 different operations (file preparation, ftp & audit operations). I have attached @EnableBatchProcessing configuration file for your reference. Here are my questions related to Spring Cloud Data Flow.
- Can Spring cloud data flow project be built using Gradle ?. I see all the sample projects built using Maven and official Spring page says Maven is must for Spring Cloud Data Flow. Gradle is the only approved build project in our company.
- We are looking for Spring batch admin UI kind of features or operations in Spring Cloud data flow. May i know how can i configure Jobs in Spring Cloud data flow? any sample project?
- Our application is deployed into PCF(Pivotal Cloud Foundry) container. So the question is, Do we need to add any services/plugins/space must be allocated in PCF infrastructure to support Spring Cloud data flow ?...
- Is Spring Cloud data flow project production ready ?. can this be used in Production?.
@Configuration
@EnableBatchProcessing
public class TaskletsConfig {
@Autowired
private JobBuilderFactory jobs;
@Autowired
private StepBuilderFactory steps;
@Bean
protected Step flatFilePreparation() {
return steps
.get("flatFilePreparation")
.tasklet(new FlatFilePreparation())
.build();
}
@Bean
protected Step ftpFile() {
return steps
.get("ftpFile")
.tasklet(new FtpFile())
.build();
}
@Bean
protected Step auditFilePreparation() {
return steps
.get("auditFilePreparation")
.tasklet(new AuditFilePreparation())
.build();
}
@Bean
protected Step errorStep() {
return steps
.get("errorStep")
.tasklet(new ErrorStep())
.build();
}
@Bean
public Job job() {
return jobs.get("psbijob").start(flatFilePreparation()).on(ExitStatus.FAILED.getExitCode()).to(errorStep())
.from(flatFilePreparation()).on("*").to(ftpFile()).on(ExitStatus.FAILED.getExitCode()).to(errorStep())
.from(ftpFile()).on("*").to(auditFilePreparation()).end().build();
}
@Bean
public JobRepository jobRepository() throws Exception {
MapJobRepositoryFactoryBean factory
= new MapJobRepositoryFactoryBean();
factory.setTransactionManager(transactionManager());
return (JobRepository) factory.getObject();
}
@Bean
public PlatformTransactionManager transactionManager() {
return new ResourcelessTransactionManager();
}
@Bean
public JobLauncher jobLauncher() throws Exception {
SimpleJobLauncher jobLauncher = new SimpleJobLauncher();
jobLauncher.setJobRepository(jobRepository());
return jobLauncher;
}
}