2
votes

I have a basic spring batch app that runs on embedded Apache Tomcat in spring boot. I need to add spring admin capabilities to it. As per latest spring docs, I need to use spring cloud data flow to do this (https://docs.spring.io/spring-batch-admin/). So now I need to use spring cloud dataflow and integrate my spring batch app on local server. I just want it to run on my local machine under tomcat without deploying it to any cloud environments like cloud foundry or openshift. Is it possible? I am sure its possible. I would like to get some references/Examples on this type of integration and starter guide integrating spring batch app. Do I need to create tasks in spring cloud data flow to run my spring batch app? If there are any sample examples/pseudo code to guide me then it would be easy.

1
@Sabby Anandan could you help me with this questionkarthik
I tried to follow the documentation. Correct me if I am did anything wrong.So I added the @enabletask to my Mainclass in springBatchApplication.So this should make it as spring cloud task. Then running the spring cloud data flow jar gave me a UI where I registered jar as task & tried to launch it. So launching it didn't do much. The app is not launched it has below values in task detail with task status in exe tab as unknown. Property valu Arguments Extenal Execution Id N/A Strt Time N/A Ed Time N/A Batch Job Job Exection Ids Strt Time N/A End Time N/A Exit Coe 0 Exit Message N/Akarthik
This is not very helpful. Please pay attention to server console/logs. There will be an absolute path - a link - to tail the "launched task", which might say why it failed. The server logs should also say why the launch failed as well.Sabby Anandan
Perhaps as the first step, you can run one of the sample SCT apps in SCDF to get a feel for it. Once you are successful with it, you can move next to your app migration.Sabby Anandan
I am having this error on logs Failed to start bean 'taskLifecycleListener'; nested exception is org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [INSERT into TASK_EXECUTION(TASK_EXECUTION_ID, START_TIME, TASK_NAME, LAST_UPDATED, EXTERNAL_EXECUTION_ID, PARENT_EXECUTION_ID)values (?, ?, ?, ?, ?, ?)]; nested exception is java.sql.SQLSyntaxErrorException: ORA-00904: "PARENT_EXECUTION_ID": invalid identifier at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178) ~[spring-context-4.3.11.RELEASE.jkarthik

1 Answers

2
votes

As described in the migration-guide, you can use the "local" variant of Spring Cloud Data Flow (SCDF) as a replacement to Spring Batch Admin (SBA).

SCDF is a simple Spring Boot application that you can run it as a standalone Java process similar to how you're running the application today.

Also, as described in the migration-steps, you'd have to port your existing batch workload to Spring Cloud Task model, and that should be a straightforward process - use this Spring Batch sample. To the most part, you'd copy/paste the business logic into a Spring Cloud Task application and all the infrastructure including schemas, repository, and other batch goodies will continue to work. There are few complex implementations in task-app-starers, which can be used as a reference, too.

Lastly, you can use SCDF's dashboard for monitoring and management.