Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring Integration and Spring Batch

 
jianming chen
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used Spring integration in a lot of cases and really liked it. And I found it is also very handy to create cron integration jobs by using polling channel.
But in the case like I have huge files to process nightly, I can use Spring integration to do the work, but Spring Batch looks like more appropriate for the work.
so what is the best argument to make choice?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There doesn't have to be a choice. As a matter of fact a huge amount of Spring Batch Jobs also uses Spring Integration. Because many times the processing requires talking to many systems and Spring Integration really helps out there.

Sometimes Spring Integration can be used to fire off a Batch job. For instance, wouldn't it be cool that if a Batch job fails you receive a tweet on twitter that you can reply back to to fire a rerun of the job?

Mark
 
Gunnar Hillert
Spring Integration Committer
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Take a look at chapter 16 of "Spring Integration in Action": "Integrating Spring Batch and Spring Integration". It provides a very good overview of how to integrate Spring Batch and Spring Integration:

* Launching batch jobs through messages
* Providing feedback with informational messages (via StepListener, ChunkListener, JobExecutionListener)
* Externalize batch process execution (Call Spring Integration from inside batch jobs)

We talked a little bit about those options in our recent (2012) SpringOne talk: http://www.slideshare.net/hillert/introduction-to-spring-integration-and-spring-batch
There will also be an audio/video recording of that presentation available in the upcoming weeks/months.

As Spring Integration and Spring Batch are under the same umbrella of Spring projects, you will see an increasingly tighter integration between Spring Batch and Spring Integration. As for your specific situation, take a look at the features provided by Spring Batch. I believe one could make an argument that for simple use-cases with small batch files, you can do the job efficiently using Spring Integration only (Use the simple/more generic tool first). However, if you start dealing with massive files that don't easily fit into memory anymore, take a very long time to process, and you start feeling the pain, then you probably need to seriously consider Spring Batch. Other people may have a different view point but I hope this provides you with some useful guidance.

Cheers,

Gunnar

Disclaimer: I am a Spring Integration committer
 
Saifuddin Merchant
Ranch Hand
Posts: 607
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd say Spring Batch would fit the bill when you need to do BATCH processing - Batch frameworks have a shared vocabulary & need. Batch provides features like re-startability, chuck-commit, multi-threading support out of the box.
Spring Batch also offers a lot of the shelf Reader and Writer components - that make writing batch jobs more standard and easy.

If you are looking for these features for a "Job" why re-invent the wheel - use Spring Batch.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic