3

I've found that there are 3 projects:

I can't understand the difference between spring-integration and spring-batch. I understand that spring batch is about batch processing, about multi-steps jobs, about partitionning, statitistcs, exception handling and if we failed in the middle of 2GB CSV file we can later proceed from that place.

I tried to google some examples of spring batch and found out examples where the reader and writer can be absolutely different(file, database, message queue, sftp file etc. etc.)

I initially thought that spring integration is set of convenient connectors to different endpoints like file, database, message queue, sftp file etc. etc. but looks like spring batch can do it.

Could you please provide any use cases to use spring batch and spring integration and when I nedd bith of them?

2
  • 2
    Spring Integration is all about messaging between components and processes. Spring Batch is about batch submission of divisible parts of work. "spring batch integration" is not a project, it is just advise on how to use both projects together.
    – Michael
    Jul 31, 2019 at 13:18
  • 2
    Spring Integration is an implementation of the Enterprise Integration Patterns in Java, using the Spring Framework.
    – Jesper
    Jul 31, 2019 at 13:35

2 Answers 2

4

While Spring Batch is used to launch jobs and write batch processing applications, Spring Integration is another project used (as described in the Docs) to enable lightweight messaging within Spring-based applications and supports integration with external systems via declarative adapters.

So basically these are two completely different projects that are designed to handle/operate on separate levels each, and are used for different type of requirements that can't be handled by the other one, that's why spring-batch-integration was designed to allow the use of both projects together and to profit from the two projects for the same requirements.

You can see that in the Spring Batch Integration Introduction section of the Docs where it says:

Many users of Spring Batch may encounter requirements that are outside the scope of Spring Batch but that may be efficiently and concisely implemented by using Spring Integration. Conversely, Spring Integration users may encounter Spring Batch requirements and need a way to efficiently integrate both frameworks. In this context, several patterns and use-cases emerge, and Spring Batch Integration addresses those requirements.

Regarding the examples of use cases where you will need to use both projects together, there are several similar requirements that we can face, you can think of a batch job that needs to address a spring integration flow in one of its steps, or even a spring integration flow that need to launch a Spring batch job.

2

Spring Integration and Spring Batch are different projects with different goals

spring-batch-integration (part of spring-batch) has components that allow you to launch a batch job from a Spring Integration message flow, as well as components to configure a batch job to distribute work (parts of the batch job) to multiple "worker nodes" using either "remote chunking" or "partitioning".

I suggest you read the Spring Batch and Spring Integration documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.