What’s New in Spring Batch 3.0

The Spring Batch 3.0 release has five major themes:

  • JSR-352 Support
  • Upgrade to Support Spring 4 and Java 8
  • Promote Spring Batch Integration to Spring Batch
  • JobScope Support
  • SQLite Support

JSR-352 Support-

JSR-352 is the new java specification for batch processing. Heavily inspired by Spring Batch, this specification provides similar functionality to what Spring Batch already supports. However, Spring Batch 3.0 has implemented the specification and now supports the definition of batch jobs in compliance with the standard. An example of a batch job configured using JSR-352’s Job Specification Language (JSL) would look like below:

<?xml version="1.0" encoding="UTF-8"?>
<job id="myJob3" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
    <step id="step1" >
        <batchlet ref="testBatchlet" />
    </step>
</job>

It is important to point out that Spring Batch does not just implement JSR-352. It goes much further than the spec in a number of ways:

  • Components – Spring Batch provides 17 different ItemReader implementations, 16 ItemWriter implementations, and many other components that have years of testing in production environments under their belts.
  • Scalability – JSR-352 provides scaling options for a single JVM only (partitioning and splits both via threads). Spring Batch provides multi-JVM scalability options including remote partitioning and remote chunking.
  • Spring dependency injection – While JSR-352 provides a form of “dependency injection light”, there are a number of limitations that it places on the construction of batch artifacts (must use no-arg constructors for example). Spring Batch is built on Spring and benefits from the power of the Spring Framework’s capabilities.
  • Java based configuration – While Spring’s XML based configuration options are well known, Spring and specifically Spring Batch, provide the option to configure your jobs using the type safety of java based configuration.
  • Hadoop/Big Data integration – Spring Batch is a foundational tool for interacting with Hadoop and other big data stores in the Spring ecosystem. Spring for Apache Hadoop provides a number of batch related extensions to use Spring Batch to orchestrate work on a Hadoop cluster. Spring XD builds on Spring Batch by providing both execution capabilities, but also management functionality similar to Spring Batch Admin for any environment.

Spring will continue to participate in the evolution of JSR-352 as it goes through maintenance revisions and look forward to further contributions to the JCP process.

Upgrade to Support Spring 4 and Java 8

With the promotion of Spring Batch Integration to be a module of the Spring Batch project, it has been updated to use Spring Integration 4. Spring Integration 4 moves the core messaging APIs to Spring core. Because of this, Spring Batch 3 will now require Spring 4 or greater.

As part of the dependency updates that have occurred with this major release, Spring Batch now supports being run on Java 8. It will still execute on Java 6 or higher as well.

Promote Spring Batch Integration to Spring Batch

Spring Batch Integration has been a sub module of the Spring Batch Admin project now for a few years. It provides functionality to better integrate the capabilities provided in Spring Integration with Spring Batch. Specific functionality includes:

  • Asynchronous ItemProcessor/ItemWriter – Executes the ItemProcessor logic on another thread, returning a Future to the ItemWriter. Once the Future returns, the result is written.
  • JobLaunchingMessageHandler/JobLaunchingMessageGateway – Provides the ability to launch jobs via Spring Messages received over channels.
  • Remote Chunking – Provides the ability to execute ItemProcessor logic remotely (across multiple JVMs) via a master/slave configuration.
  • Remote Partitioning – Provides the ability to execute full chunks remotely (read/process/write across multiple JVMs) via a master/slave configuration.

JobScope Support

The Spring scope “step” used in Spring Batch has had a pivotal role in batch applications, providing late binding functionality for a long time now. With the 3.0 release Spring Batch now supports a “job” scope. This new scope allows for the delayed construction of objects until a Job is actually launched as well as providing a facility for new instances for each execution of a job.

SQLite Support

SQLite has been added as a newly supported database option for the JobRepository by adding job repository ddl for SQLite. This provides a useful, file based, data store for testing purposes.

References

http://docs.spring.io/spring-batch/trunk/reference/html/whatsNew.html
https://spring.io/blog/2014/02/24/spring-batch-3-0-milestone-3-released

Previous
Next

5 Comments

  1. Utkal Samal December 4, 2014
  2. Dinesh Rajput December 6, 2014
  3. Shantha D December 19, 2014
  4. Dinesh Rajput December 19, 2014
  5. Gopi Arumugam January 24, 2015