Minimal and latest way of triggering batch job in the world of Spring Boot - spring-boot

I have setup a batch job with Spring Boot 1.5.8 and relevant Spring Batch and Integration starters. I want to kick off the job using incoming file using file poller.
I have used Spring Integration in old days to trigger batch job with file poller. Is this still stands same ? Does Spring Batch itself has this very basic functionality or do I have to have Spring Integration involved as well ?
Even if Spring Integration is needed, can anybody point to Annotation based sample application doing the same ?

Good questions. Let's answer each of them:
Is this still stands same ? Yes
Does Spring Batch itself has this very basic functionality or do I have to have Spring Integration involved as well ? No, you have to use Spring Integration
Even if Spring Integration is needed, can anybody point to Annotation based sample application doing the same ?
We are in the midst of updating all the Batch docs to include annotation as well as XML based configurations. Here is a doc that is in PR but will be merged in the next release that has the examples you are looking for:
https://github.com/cppwfs/spring-batch/blob/1f7cada52aba95bcb23d06bc034b21fe1de0a7a5/spring-batch-docs/asciidoc/spring-batch-integration.adoc#launching-batch-jobs-through-messages

Related

BPMN for spring boot 2

We have started new project on spring stack and using latest versions. But we have workflow requirement and I used activiti in past. But as I see there is no spring boot 2 support for activiti and camunda. Can anybody suggest which BPM is best that can be integrated with spring boot 2.
You will find a bunch of Spring Boot 2 starters in the Flowable github repo.
The documentation explains step-by-step how to create a BPM enabled Spring Boot application. There is also the blog post The road to Spring Boot 2.0 that the improved support for Flowable within Spring Boot as part of the Flowable 6.3.0 release.
You ask for suggestions on which BPM is best. Well, I cannot be objective since I am part of the Flowable Team, but I can say that our Spring Boot implementation is pretty neat:
All engines are supported (BPMN, CMMN, DMN), both embedded and exposing their respective REST APIs.
There is an automatic configuration of Spring Security to use the Flowable IDM engine (in case no other custom security is configured).
There is no "EE" version of the starter. Flowable provides Spring Boot 2 support 100% Open Source.
The Spring Actuator integration is quite powerful.
Did I mention Open Source? ;-)
In order to get the all engines you would need to use the flowable-spring-boot-starter(-rest) dependency. The (-rest) needs to be used if you want the Flowable REST APIs to be automatically configured.
There is also the option to run the BPMN, CMMN or DMN engines in standalone mode. For that you would need one of the following dependencies:
flowable-spring-boot-starter-process(-rest)
flowable-spring-boot-starter-cmmn(-rest)
flowable-spring-boot-starter-dmn(-rest)
So, compare for yourself, but for me, it's pretty clear and of course I am open to discussion.
The Activiti is working on Activiti Cloud fully based on Spring Boot 2 and Spring Cloud Finchley (targeting kubernetes deployments, but it can be used outside kubernetes if that is not your thing) if you are looking for a BPMN runtime for Cloud Native applications. We are working hard on releasing the first Beta1 release at the moment, and we will very welcome feedback about it. Hope this helps.
If you use the camunda-bpm-spring-boot-starter you can write self contained services running camunda process engine with spring boot 2.

Spring Batch Java annotated - restart example

Using the Spring Boot, Batch example: https://spring.io/guides/gs/batch-processing/
Project is now running, but the site doesn't go into how to write Unit tests around this structure. Github examples for Spring Batch show xml examples, which do not seem to correlate to this boot style.
Has anyone ran into any good Spring Boot, Batch examples that show restarting, unit testing, etc
The reference documentation was recently updated to provide java based configuration examples for every example in the doc. You can check out our testing page and see the java examples here: https://docs.spring.io/spring-batch/4.0.x/reference/html/testing.html#testing

Can SpringBoot be use for Backend application?

One of the Spring framework advantage is dependency injection. Many had used SpringBoot for providing REST Web Services.
Read up and notice there are Scheduler and CommandLineRunner for SpringBoot, could we using SpringBoot for backend type of application to replace the usual standalone java program while making use of SpringBoot advantage (Dependency Injection)
- Cron Job (Execute and stop running)
- Long Running Process
One of the main thing I am looking into is to use annotation such as Spring Configuration, Spring Data JPA and other technology in backend application.
Of course!
I used spring boot to back CLI projects, DB access projects and more.
Spring boot is very modular. It works by providing auto-configuration based on your maven/gradle imports. If you don't import starter-web/starter-jersey or any other starter that is for the web/rest api, the auto-configuration for this resources won't be triggered and you can basically enjoy all the power of spring boot to support your needs
Definitely,
Spring boot is not a separate framework.It reduces the configuration difficulties when you using spring framework. Spring boot provides a Rapid Application Development using without complex configuration including your dispatcher servlet, XML file for database connectivity and configuration files. You can use spring boot for back-end development. Simply says you can do everything what you does in spring MVC without any complex configuration. If you are using spring boot , You can configure your database details in application.properties file. I am adding one of two links for proper reading,
https://projects.spring.io/spring-boot/ ,
https://dzone.com/articles/why-springboot

Spring batch admin upgrade

I am working on a application to upgrade it to JAVA 8.
It is using spring integration, spring batch and spring batch admin.
For spring integration and spring batch to work on java 8, we have to upgrade it to latest spring integration which is 4.3.5 (this is what I'm trying to use) and spring batch to 3.0.7.
Problem I am facing is while upgrading SPRING BATCH ADMIN, which was last released in jan 2015 and internally it uses old spring integration version.
Wanted to ask- what are my options as application is very much depending on spring batch admin?
Is there any alternative for spring batch admin which can be used with spring integration 4.3.5 and spring batch 3.0.7.
Need advice and help regarding the same.
Note: I have read somewhere that I can use spring boot admin.
Please let me know if need more clarification on above question.
.
Spring Batch Admin project is deprecated. There won't be 2.0.0 release.
Spring Cloud Data Flow isn't direct alternative to Spring Batch Admin. It is about orchestration of processes in cloud environment while Spring Batch Admin is a dashboard for BATCH_ tables, though this functionality is present in Data Flow in its own way ))
UPDATE If you are in 2022, check this de.codecentric:batch-web-spring-boot-starter:
https://github.com/codecentric/spring-boot-starter-batch-web
https://blog.codecentric.de/batch-web-spring-boot-starter-2-0-1-released
https://mvnrepository.com/artifact/de.codecentric/batch-web-spring-boot-starter
This is a fork of spring-batch-admin that might be useful...
https://github.com/httpants/spring-batch-admin

Spring XD and Oracle RDBMS

I am newbie to Spring XD. I have a requirement to parse a file in a specific directory and push the output in oracle table.
Can I achieve that in Spring XD?
If not directly, can I create Spring boot/integration/batch application and deploy the same on Sprig XD?
Thanks,
Pratik
If I understood correctly, you want to deploy an ETL process on SpringXD.
Yes, this is possible, in fact, I once worked on that.
Spring Integration is ok with springXD and the things you should do is to adjust some parts of the context.
You can use task module in springXD to do ETL
Thanks for the inputs folks!
Well, I have learned Spring Batch framework and I am building the tasklets to manage my workflow to support my usecase.
Further, I am The resultant Jar of Spring Batch app to SpringXD as a Custom Module and scheduled it for a daily run.
I learnt from the research on this usecase that SpringXD is superset of and includes Spring Batch, Integration and Boot frameworks respectively; so
I kept the involvement of SpringXD as limited to Scheduling a batch job by adding custom module.
Thanks a lot for your support.
Cheers & Happy Architecting,
Pratik

Resources