Spring Batch 2 will support work partitioning and annotation based configuration

Source: Internet
Author: User

The new features of this release can be grouped into four categories: support for Java 5, non sequential execution, enhanced scalability, and annotations.

Support for Java 5:

Spring Batch version 2.0 supports Java 5 generics and parameterized types so that type security can be checked at compile time. For example, the Itemreader interface now has a type-safe Read method.

Non-sequential execution:

This actually includes 3 new features--condition, pause, and parallel execution. By virtue of these features, the steps can be performed in a non-linear order. Even if a step in the work (job) fails, the entire work is still complete. Conditional execution (Conditional execution) divides the work into different branches according to the last exitstatus. This also includes the ability to perform branching tasks in the failed state, which means that one step failure is no longer a fatal error in the entire work. Pause execution (Pause execution) can be used to stop or wait for an external command (explicit instruction), which is useful when business rules require manual intervention to check whether business-critical data is valid. For multi-step parallel execution (parallel execution), each step is independent of each other, and the user can specify which branches can be executed in parallel.

Scalability:

The new version uses two methods to support the parallel execution of multiple processes: remote segmentation and partitioning. Remote segmentation is a technique that divides the specific work of a step without any detailed knowledge of the data structure. Any input source can be split dynamically, simply by reading the input source through a single process and sending it as an entire block to the remote worker process. The remote worker process implements the listener mode, responds to requests, processes the data, and sends replies asynchronously. The transmission of requests and responses must be persistent, assured, and only a single consumer, which is already available in all JMS implementations. Spring batch is the remote partitioning feature built on the spring integration, so it doesn't have to care about the actual implementation of message middleware.

Partitioning is another way to achieve scalability, by contrast, it needs to know the structure of the input data, such as the scope of the primary key, or the name of the file to process. The advantage of this pattern is that the processor for each element in the partition can be considered a single step in the normal spring batch work. They do not implement any particular pattern and are therefore easy to configure and test. Partitioning is more scalable than remote segmentation because there is no serialization bottleneck when reading all input data in the same place. In Spring Batch 2.0, the partition is supported by two interfaces: Partitionhandler and Stepexecutionsplitter.

Annotation based configuration:

Spring batch components such as reader, writer, processor, listener, can be configured using annotations, and can be inserted into a step of a task. This is done by using the XML namespace for spring batch.

The new version also has a number of changes in application monitoring, including statistics on the counts of performing or skipping items, bookkeeping, and the split count of reading, processing, and writing to all items at each stage. For applications that do not divide execution into the steps (or tasklet) of reading, processing, writing, etc., these statistics are more comprehensive than necessary, but in most cases this is preferable to storing only the total number of items.

SpringSource plans to provide a complete runtime solution for partitioning and remote segmentation, as well as management and scheduling, in enterprise-class batch products. Its future roadmap also includes adding Spring 3.0 dependencies for Spring Batch 2.1 (while retaining 2.5.6 as optional). It is for such a plan that the features covered in the new version are mostly configured for work and procedure, especially in the configuration process using Spring Expression Language (EL) delay binding (late binding), which is the syntax of the deferred binding and the spring Batch 2.0 are basically the same, but provide more features, more flexibility.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.