{"id":6014,"date":"2012-12-22T15:00:29","date_gmt":"2012-12-22T13:00:29","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=6014"},"modified":"2012-12-22T10:44:41","modified_gmt":"2012-12-22T08:44:41","slug":"chunk-oriented-processing-in-spring-batch","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2012\/12\/chunk-oriented-processing-in-spring-batch.html","title":{"rendered":"Chunk Oriented Processing in Spring Batch"},"content":{"rendered":"<p>Big Data Sets\u2019 Processing is one of the most important problem in the software world. Spring Batch is a lightweight and robust batch framework to process the data sets.<\/p>\n<p>Spring Batch Framework offers \u2018TaskletStep Oriented\u2019 and \u2018Chunk Oriented\u2019 processing style. In this article, Chunk Oriented Processing Model is explained. Also, <strong><a title=\"TaskletStep Oriented Processing in Spring Batch\" href=\"http:\/\/www.onlinetechvision.com\/?p=658\" target=\"_blank\">TaskletStep Oriented Processing in Spring Batch<\/a><\/strong> Article is definitely suggested to investigate how to develop TaskletStep Oriented Processing in Spring Batch.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\nChunk Oriented Processing Feature has come with Spring Batch v2.0. It refers to reading the data one at a time, and creating \u2018chunks\u2019 that will be written out, within a transaction boundary. One item is read from an <strong>ItemReader<\/strong>, handed to an <strong>ItemProcessor<\/strong>, and written. Once the number of items read equals the commit interval, the entire chunk is written out via the <strong>ItemWriter<\/strong>, and then the transaction is committed.<\/p>\n<p>Basically, this feature should be used if at least one data item\u2019 s reading and writing is required. Otherwise, TaskletStep Oriented processing can be used if the data item\u2019 s only reading or writing is required.<\/p>\n<p>Chunk Oriented Processing model exposes three important interface as <strong>ItemReader<\/strong>, <strong>ItemProcessor<\/strong> and <strong>ItemWriter<\/strong> via <strong>org.springframework.batch.item<\/strong> package.<\/p>\n<ul>\n<li><strong>ItemReader :<\/strong> This interface is used for providing the data. It reads the data which will be processed.<\/li>\n<li><strong>ItemProcessor :<\/strong> This interface is used for item transformation. It processes input object and transforms to output object.<\/li>\n<li><strong>ItemWriter :<\/strong> This interface is used for generic output operations. It writes the datas which are transformed by <strong>ItemProcessor<\/strong>. For example, the datas can be written to database, memory or outputstream (etc). In this sample application, we will write to database.<\/li>\n<\/ul>\n<p>Let us take a look how to develop Chunk Oriented Processing Model.<\/p>\n<p><strong>Used Technologies :<\/strong><\/p>\n<ul>\n<li>JDK 1.7.0_09<\/li>\n<li>Spring 3.1.3<\/li>\n<li>Spring Batch 2.1.9<\/li>\n<li>Hibernate 4.1.8<\/li>\n<li>Tomcat JDBC 7.0.27<\/li>\n<li>MySQL 5.5.8<\/li>\n<li>MySQL Connector 5.1.17<\/li>\n<li>Maven 3.0.4<\/li>\n<\/ul>\n<h2>STEP 1 : CREATE MAVEN PROJECT<\/h2>\n<p>A maven project is created as below. (It can be created by using Maven or IDE Plug-in).<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/Spring-Batch-Chunk-Oriented-Processing2.png\"><img decoding=\"async\" class=\"aligncenter\" title=\"Spring Batch - Chunk Oriented Processing\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/Spring-Batch-Chunk-Oriented-Processing2.png\" alt=\"\" width=\"290\" height=\"633\" \/><\/a><\/p>\n<h2>STEP 2 : LIBRARIES<\/h2>\n<p>A new USER Table is created by executing below script:<\/p>\n<pre class=\" brush:xml\">CREATE TABLE ONLINETECHVISION.USER (\r\n   id int(11) NOT NULL AUTO_INCREMENT,\r\n   name varchar(45) NOT NULL,\r\n   surname varchar(45) NOT NULL,\r\n   PRIMARY KEY (`id`)\r\n);<\/pre>\n<h2>STEP 3 : LIBRARIES<\/h2>\n<p>Firstly, dependencies are added to Maven\u2019 s pom.xml.<\/p>\n<pre class=\" brush:xml\">  &lt;properties&gt;\r\n      &lt;spring.version&gt;3.1.3.RELEASE&lt;\/spring.version&gt;\r\n      &lt;spring-batch.version&gt;2.1.9.RELEASE&lt;\/spring-batch.version&gt;\r\n  &lt;\/properties&gt;\r\n\r\n  &lt;dependencies&gt;\r\n\r\n     &lt;dependency&gt;\r\n         &lt;groupId&gt;org.springframework&lt;\/groupId&gt;\r\n         &lt;artifactId&gt;spring-core&lt;\/artifactId&gt;\r\n         &lt;version&gt;${spring.version}&lt;\/version&gt;\r\n     &lt;\/dependency&gt;\r\n\r\n     &lt;dependency&gt;\r\n         &lt;groupId&gt;org.springframework&lt;\/groupId&gt;\r\n         &lt;artifactId&gt;spring-context&lt;\/artifactId&gt;\r\n         &lt;version&gt;${spring.version}&lt;\/version&gt;\r\n     &lt;\/dependency&gt;    \r\n\r\n\t &lt;dependency&gt;\r\n\t\t&lt;groupId&gt;org.springframework&lt;\/groupId&gt;\r\n\t\t&lt;artifactId&gt;spring-tx&lt;\/artifactId&gt;\r\n\t\t&lt;version&gt;${spring.version}&lt;\/version&gt;\r\n\t &lt;\/dependency&gt;\r\n\r\n\t &lt;dependency&gt;\r\n\t\t&lt;groupId&gt;org.springframework&lt;\/groupId&gt;\r\n\t\t&lt;artifactId&gt;spring-orm&lt;\/artifactId&gt;\r\n\t\t&lt;version&gt;${spring.version}&lt;\/version&gt;\r\n\t &lt;\/dependency&gt;\r\n\r\n\t &lt;dependency&gt;\r\n\t\t&lt;groupId&gt;org.springframework.batch&lt;\/groupId&gt;\r\n\t\t&lt;artifactId&gt;spring-batch-core&lt;\/artifactId&gt;\r\n\t\t&lt;version&gt;${spring-batch.version}&lt;\/version&gt;\r\n\t &lt;\/dependency&gt;\r\n\r\n\t &lt;!-- Hibernate dependencies --&gt;\r\n     &lt;dependency&gt;\r\n        &lt;groupId&gt;org.hibernate&lt;\/groupId&gt;\r\n        &lt;artifactId&gt;hibernate-core&lt;\/artifactId&gt;\r\n        &lt;version&gt;4.1.8.Final&lt;\/version&gt;\r\n     &lt;\/dependency&gt;\r\n\r\n\t  &lt;!-- Tomcat DBCP --&gt;\r\n\t &lt;dependency&gt;\r\n\t\t&lt;groupId&gt;org.apache.tomcat&lt;\/groupId&gt;\r\n\t\t&lt;artifactId&gt;tomcat-jdbc&lt;\/artifactId&gt;\r\n\t\t&lt;version&gt;7.0.27&lt;\/version&gt;\r\n\t &lt;\/dependency&gt;\r\n\r\n\t &lt;!-- MySQL Java Connector library --&gt;\r\n\t &lt;dependency&gt;\r\n\t\t&lt;groupId&gt;mysql&lt;\/groupId&gt;\r\n\t\t&lt;artifactId&gt;mysql-connector-java&lt;\/artifactId&gt;\r\n\t\t&lt;version&gt;5.1.17&lt;\/version&gt;\r\n\t &lt;\/dependency&gt;\r\n\r\n\t &lt;!-- Log4j library --&gt;\r\n\t &lt;dependency&gt;\r\n\t\t&lt;groupId&gt;log4j&lt;\/groupId&gt;\r\n\t\t&lt;artifactId&gt;log4j&lt;\/artifactId&gt;\r\n\t\t&lt;version&gt;1.2.16&lt;\/version&gt;\r\n\t &lt;\/dependency&gt;\r\n\r\n  &lt;\/dependencies&gt;<\/pre>\n<p><strong>maven-compiler-plugin<\/strong>(Maven Plugin) is used to compile the project with JDK 1.7<\/p>\n<pre class=\" brush:xml\">\t&lt;plugin&gt;\r\n\t\t&lt;groupId&gt;org.apache.maven.plugins&lt;\/groupId&gt;\r\n\t\t&lt;artifactId&gt;maven-compiler-plugin&lt;\/artifactId&gt;\r\n\t\t&lt;version&gt;3.0&lt;\/version&gt;\r\n\t\t&lt;configuration&gt;\r\n\t\t  &lt;source&gt;1.7&lt;\/source&gt;\r\n\t\t  &lt;target&gt;1.7&lt;\/target&gt;\r\n\t\t&lt;\/configuration&gt;\r\n\t&lt;\/plugin&gt;<\/pre>\n<p>The following Maven plugin can be used to create <strong>runnable-jar<\/strong>,<\/p>\n<pre class=\" brush:xml\">\t&lt;plugin&gt;\r\n\t\t&lt;groupId&gt;org.apache.maven.plugins&lt;\/groupId&gt;\r\n\t\t&lt;artifactId&gt;maven-shade-plugin&lt;\/artifactId&gt;\r\n\t\t&lt;version&gt;2.0&lt;\/version&gt;\r\n\r\n\t\t&lt;executions&gt;\r\n\t\t\t&lt;execution&gt;\r\n\t\t\t\t&lt;phase&gt;package&lt;\/phase&gt;\r\n\t\t\t\t&lt;goals&gt;\r\n\t\t\t\t\t&lt;goal&gt;shade&lt;\/goal&gt;\r\n\t\t\t\t&lt;\/goals&gt;\r\n\t\t\t\t&lt;configuration&gt;\r\n\t\t\t\t\t&lt;configuration&gt;\r\n\t\t\t          &lt;source&gt;1.7&lt;\/source&gt;\r\n\t\t\t          &lt;target&gt;1.7&lt;\/target&gt;\r\n\t\t\t        &lt;\/configuration&gt;\r\n\t\t\t\t\t&lt;transformers&gt;\r\n\t\t\t\t\t\t&lt;transformer\r\n\t\t\t\t\t\t\timplementation='org.apache.maven.plugins.shade.resource.\r\nManifestResourceTransformer'&gt;\r\n\t\t\t\t\t\t\t&lt;mainClass&gt;com.onlinetechvision.exe.Application&lt;\/mainClass&gt;\r\n\t\t\t\t\t\t&lt;\/transformer&gt;\r\n\t\t\t\t\t\t&lt;transformer\r\n\t\t\t\t\t\t\timplementation='org.apache.maven.plugins.shade.resource.\r\nAppendingTransformer'&gt;\r\n\t\t\t\t\t\t\t&lt;resource&gt;META-INF\/spring.handlers&lt;\/resource&gt;\r\n\t\t\t\t\t\t&lt;\/transformer&gt;\r\n\t\t\t\t\t\t&lt;transformer\r\n\t\t\t\t\t\t\timplementation='org.apache.maven.plugins.shade.resource.\r\nAppendingTransformer'&gt;\r\n\t\t\t\t\t\t\t&lt;resource&gt;META-INF\/spring.schemas&lt;\/resource&gt;\r\n\t\t\t\t\t\t&lt;\/transformer&gt;\r\n\t\t\t\t\t&lt;\/transformers&gt;\r\n\t\t\t\t&lt;\/configuration&gt;\r\n\t\t\t&lt;\/execution&gt;\r\n\t\t&lt;\/executions&gt;\r\n\t&lt;\/plugin&gt;<\/pre>\n<p><strong>STEP 4 : CREATE User ENTITY<\/strong><\/p>\n<p><strong>User<\/strong> Entity is created. This entity will be stored after processing.<\/p>\n<pre class=\" brush:java\">package com.onlinetechvision.user;\r\n\r\nimport javax.persistence.Column;\r\nimport javax.persistence.Entity;\r\nimport javax.persistence.GeneratedValue;\r\nimport javax.persistence.GenerationType;\r\nimport javax.persistence.Id;\r\nimport javax.persistence.Table;\r\n\r\n\/**\r\n * User Entity\r\n *\r\n * @author onlinetechvision.com\r\n * @since 10 Dec 2012\r\n * @version 1.0.0\r\n *\r\n *\/\r\n@Entity\r\n@Table(name='USER')\r\npublic class User {\r\n\r\n    private int id;\r\n    private String name;\r\n    private String surname;\r\n\r\n    @Id\r\n    @GeneratedValue(strategy=GenerationType.AUTO)\r\n    @Column(name='ID', unique = true, nullable = false)\r\n    public int getId() {\r\n        return id;\r\n    }\r\n\r\n    public void setId(int id) {\r\n        this.id = id;\r\n    }\r\n\r\n    @Column(name='NAME', unique = true, nullable = false)\r\n    public String getName() {\r\n        return name;\r\n    }\r\n\r\n    public void setName(String name) {\r\n        this.name = name;\r\n    }\r\n\r\n    @Column(name='SURNAME', unique = true, nullable = false)\r\n    public String getSurname() {\r\n        return surname;\r\n    }\r\n\r\n    public void setSurname(String surname) {\r\n        this.surname = surname;\r\n    }   \r\n\r\n    @Override\r\n    public String toString() {\r\n        StringBuffer strBuff = new StringBuffer();\r\n        strBuff.append('id : ').append(getId());\r\n        strBuff.append(', name : ').append(getName());\r\n        strBuff.append(', surname : ').append(getSurname());\r\n        return strBuff.toString();\r\n    }\r\n}<\/pre>\n<h2>STEP 5 : CREATE IUserDAO INTERFACE<\/h2>\n<p><strong>IUserDAO<\/strong> Interface is created to expose data access functionality.<\/p>\n<pre class=\" brush:java\">package com.onlinetechvision.user.dao;\r\n\r\nimport java.util.List;\r\n\r\nimport com.onlinetechvision.user.User;\r\n\r\n\/**\r\n * User DAO Interface\r\n *\r\n * @author onlinetechvision.com\r\n * @since 10 Dec 2012\r\n * @version 1.0.0\r\n *\r\n *\/\r\npublic interface IUserDAO {\r\n\r\n    \/**\r\n     * Adds User\r\n     *\r\n     * @param  User user\r\n     *\/\r\n    void addUser(User user);\r\n\r\n    \/**\r\n     * Gets User List\r\n     *\r\n     *\/\r\n    List&lt;User&gt; getUsers();\r\n}<\/pre>\n<h2>STEP 6 : CREATE UserDAO IMPL<\/h2>\n<p><strong>UserDAO<\/strong> Class is created by implementing <strong>IUserDAO<\/strong> Interface.<\/p>\n<pre class=\" brush:java\">package com.onlinetechvision.user.dao;\r\n\r\nimport java.util.List;\r\n\r\nimport org.hibernate.SessionFactory;\r\n\r\nimport com.onlinetechvision.user.User;\r\n\r\n\/**\r\n * User DAO\r\n *\r\n * @author onlinetechvision.com\r\n * @since 10 Dec 2012\r\n * @version 1.0.0\r\n *\r\n *\/\r\npublic class UserDAO implements IUserDAO {\r\n\r\n    private SessionFactory sessionFactory;\r\n\r\n    \/**\r\n     * Gets Hibernate Session Factory\r\n     *\r\n     * @return SessionFactory - Hibernate Session Factory\r\n     *\/\r\n    public SessionFactory getSessionFactory() {\r\n        return sessionFactory;\r\n    }\r\n\r\n    \/**\r\n     * Sets Hibernate Session Factory\r\n     *\r\n     * @param SessionFactory - Hibernate Session Factory\r\n     *\/\r\n    public void setSessionFactory(SessionFactory sessionFactory) {\r\n        this.sessionFactory = sessionFactory;\r\n    }\r\n\r\n    \/**\r\n     * Adds User\r\n     *\r\n     * @param  User user\r\n     *\/\r\n    @Override\r\n    public void addUser(User user) {\r\n        getSessionFactory().getCurrentSession().save(user);\r\n    }\r\n\r\n    \/**\r\n     * Gets User List\r\n     *\r\n     * @return List - User list\r\n     *\/\r\n    @SuppressWarnings({ 'unchecked' })\r\n\t@Override\r\n    public List&lt;User&gt; getUsers() {\r\n        List&lt;User&gt; list = getSessionFactory().getCurrentSession().createQuery('from User').list();\r\n        return list;\r\n    }\r\n\r\n}<\/pre>\n<p><strong>STEP 7 : CREATE IUserService INTERFACE<\/strong><\/p>\n<p><strong>IUserService<\/strong> Interface is created for service layer.<\/p>\n<pre class=\" brush:java\">package com.onlinetechvision.user.service;\r\n\r\nimport java.util.List;\r\n\r\nimport com.onlinetechvision.user.User;\r\n\r\n\/**\r\n *\r\n * User Service Interface\r\n *\r\n * @author onlinetechvision.com\r\n * @since 10 Dec 2012\r\n * @version 1.0.0\r\n *\r\n *\/\r\npublic interface IUserService {\r\n\r\n    \/**\r\n     * Adds User\r\n     *\r\n     * @param  User user\r\n     *\/\r\n    void addUser(User user);\r\n\r\n    \/**\r\n     * Gets User List\r\n     *\r\n     * @return List - User list\r\n     *\/\r\n    List&lt;User&gt; getUsers();\r\n}<\/pre>\n<h2>STEP 8 : CREATE UserService IMPL<\/h2>\n<p><strong>UserService<\/strong> Class is created by implementing <strong>IUserService<\/strong> Interface.<\/p>\n<pre class=\" brush:java\">package com.onlinetechvision.user.service;\r\n\r\nimport java.util.List;\r\n\r\nimport org.springframework.transaction.annotation.Transactional;\r\n\r\nimport com.onlinetechvision.user.User;\r\nimport com.onlinetechvision.user.dao.IUserDAO;\r\n\r\n\/**\r\n *\r\n * User Service\r\n *\r\n * @author onlinetechvision.com\r\n * @since 10 Dec 2012\r\n * @version 1.0.0\r\n *\r\n *\/\r\n@Transactional(readOnly = true)\r\npublic class UserService implements IUserService {\r\n\r\n    IUserDAO userDAO;\r\n\r\n    \/**\r\n     * Adds User\r\n     *\r\n     * @param  User user\r\n     *\/\r\n    @Transactional(readOnly = false)\r\n    @Override\r\n    public void addUser(User user) {\r\n        getUserDAO().addUser(user);\r\n    }\r\n\r\n    \/**\r\n     * Gets User List\r\n     *\r\n     *\/\r\n    @Override\r\n    public List&lt;User&gt; getUsers() {\r\n        return getUserDAO().getUsers();\r\n    }\r\n\r\n    public IUserDAO getUserDAO() {\r\n        return userDAO;\r\n    }\r\n\r\n    public void setUserDAO(IUserDAO userDAO) {\r\n        this.userDAO = userDAO;\r\n    }\r\n}<\/pre>\n<h2>STEP 9 : CREATE TestReader IMPL<\/h2>\n<p><strong>TestReader<\/strong> Class is created by implementing <strong>ItemReader<\/strong> Interface. This class is called in order to read items. When read method returns null, reading operation is completed. The following steps explains with details how to be executed firstJob.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>The commit-interval value of firstjob is 2 and the following steps are executed :<\/p>\n<p>1) firstTestReader is called to read first item(firstname_0, firstsurname_0)<br \/>\n2) firstTestReader is called again to read second item(firstname_1, firstsurname_1)<br \/>\n3) testProcessor is called to process first item(FIRSTNAME_0, FIRSTSURNAME_0)<br \/>\n4) testProcessor is called to process second item(FIRSTNAME_1, FIRSTSURNAME_1)<br \/>\n5) testWriter is called to write first item(FIRSTNAME_0, FIRSTSURNAME_0) to database<br \/>\n6) testWriter is called to write second item(FIRSTNAME_1, FIRSTSURNAME_1) to database<br \/>\n7) first and second items are committed and the transaction is closed.<br \/>\nfirstTestReader is called to read third item(firstname_2, firstsurname_2)<br \/>\n9) maxIndex value of firstTestReader is 3. read method returns null and item reading operation is completed.<br \/>\n10) testProcessor is called to process third item(FIRSTNAME_2, FIRSTSURNAME_2)<br \/>\n11) testWriter is called to write first item(FIRSTNAME_2, FIRSTSURNAME_2) to database<br \/>\n12) third item is committed and the transaction is closed.<\/p>\n<p>firstStep is completed with COMPLETED status and secondStep is started. secondJob and thirdJob are executed in the same way.<\/p>\n<pre class=\" brush:java\">package com.onlinetechvision.item;\r\n\r\nimport org.springframework.batch.item.ItemReader;\r\nimport org.springframework.batch.item.NonTransientResourceException;\r\nimport org.springframework.batch.item.ParseException;\r\nimport org.springframework.batch.item.UnexpectedInputException;\r\n\r\nimport com.onlinetechvision.user.User;\r\n\r\n\/**\r\n * TestReader Class is created to read items which will be processed\r\n *\r\n * @author onlinetechvision.com\r\n * @since 10 Dec 2012\r\n * @version 1.0.0\r\n *\r\n *\/\r\npublic class TestReader implements ItemReader&lt;User&gt; {\r\n\tprivate int index;\r\n\tprivate int maxIndex;\r\n\tprivate String namePrefix;\r\n\tprivate String surnamePrefix;\r\n\r\n\t\/**\r\n     * Reads items one by one\r\n     *\r\n     * @return User\r\n     *\r\n     * @throws Exception\r\n     * @throws UnexpectedInputException\r\n     * @throws ParseException\r\n     * @throws NonTransientResourceException\r\n     *\r\n     *\/\r\n\t@Override\r\n\tpublic User read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException {\r\n\t\tUser user = new User();\r\n\t\tuser.setName(getNamePrefix() + '_' + index);\r\n\t\tuser.setSurname(getSurnamePrefix() + '_' + index);\r\n\r\n\t\tif(index &gt; getMaxIndex()) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\tincrementIndex();\r\n\r\n\t\treturn user;\r\n\t}\r\n\r\n\t\/**\r\n     * Increments index which defines read-count\r\n     *\r\n     * @return int\r\n     *\r\n     *\/\r\n\tprivate int incrementIndex() {\r\n\t\treturn index++;\r\n\t}\r\n\r\n\tpublic int getMaxIndex() {\r\n\t\treturn maxIndex;\r\n\t}\r\n\r\n\tpublic void setMaxIndex(int maxIndex) {\r\n\t\tthis.maxIndex = maxIndex;\r\n\t}\r\n\r\n\tpublic String getNamePrefix() {\r\n\t\treturn namePrefix;\r\n\t}\r\n\r\n\tpublic void setNamePrefix(String namePrefix) {\r\n\t\tthis.namePrefix = namePrefix;\r\n\t}\r\n\r\n\tpublic String getSurnamePrefix() {\r\n\t\treturn surnamePrefix;\r\n\t}\r\n\r\n\tpublic void setSurnamePrefix(String surnamePrefix) {\r\n\t\tthis.surnamePrefix = surnamePrefix;\r\n\t}\r\n\r\n}<\/pre>\n<h2>STEP 10 : CREATE FailedCaseTestReader IMPL<\/h2>\n<p><strong>FailedCaseTestReader<\/strong> Class is created in order to simulate the failed job status. In this sample application, when thirdJob is processed at fifthStep, failedCaseTestReader is called and exception is thrown so its status will be FAILED.<\/p>\n<pre class=\" brush:java\">package com.onlinetechvision.item;\r\n\r\nimport org.springframework.batch.item.ItemReader;\r\nimport org.springframework.batch.item.NonTransientResourceException;\r\nimport org.springframework.batch.item.ParseException;\r\nimport org.springframework.batch.item.UnexpectedInputException;\r\n\r\nimport com.onlinetechvision.user.User;\r\n\r\n\/**\r\n * FailedCaseTestReader Class is created in order to simulate the failed job status.\r\n *\r\n * @author onlinetechvision.com\r\n * @since 10 Dec 2012\r\n * @version 1.0.0\r\n *\r\n *\/\r\npublic class FailedCaseTestReader implements ItemReader&lt;User&gt; {\r\n\tprivate int index;\r\n\tprivate int maxIndex;\r\n\tprivate String namePrefix;\r\n\tprivate String surnamePrefix;\r\n\r\n\t\/**\r\n     * Reads items one by one\r\n     *\r\n     * @return User\r\n     *\r\n     * @throws Exception\r\n     * @throws UnexpectedInputException\r\n     * @throws ParseException\r\n     * @throws NonTransientResourceException\r\n     *\r\n     *\/\r\n\t@Override\r\n\tpublic User read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException {\r\n\t\tUser user = new User();\r\n\t\tuser.setName(getNamePrefix() + '_' + index);\r\n\t\tuser.setSurname(getSurnamePrefix() + '_' + index);\r\n\r\n\t\tif(index &gt;= getMaxIndex()) {\r\n\t\t\tthrow new Exception('Unexpected Error!');\r\n\t\t}\r\n\r\n\t\tincrementIndex();\r\n\r\n\t\treturn user;\r\n\t}\r\n\r\n\t\/**\r\n     * Increments index which defines read-count\r\n     *\r\n     * @return int\r\n     *\r\n     *\/\r\n\tprivate int incrementIndex() {\r\n\t\treturn index++;\r\n\t}\r\n\r\n\tpublic int getMaxIndex() {\r\n\t\treturn maxIndex;\r\n\t}\r\n\r\n\tpublic void setMaxIndex(int maxIndex) {\r\n\t\tthis.maxIndex = maxIndex;\r\n\t}\r\n\r\n\tpublic String getNamePrefix() {\r\n\t\treturn namePrefix;\r\n\t}\r\n\r\n\tpublic void setNamePrefix(String namePrefix) {\r\n\t\tthis.namePrefix = namePrefix;\r\n\t}\r\n\r\n\tpublic String getSurnamePrefix() {\r\n\t\treturn surnamePrefix;\r\n\t}\r\n\r\n\tpublic void setSurnamePrefix(String surnamePrefix) {\r\n\t\tthis.surnamePrefix = surnamePrefix;\r\n\t}\r\n\r\n}<\/pre>\n<h2>STEP 11 : CREATE TestProcessor IMPL<\/h2>\n<p><strong>TestProcessor<\/strong> Class is created by implementing <strong>ItemProcessor<\/strong> Interface. This class is called to process items. User item is received from TestReader, processed and returned to TestWriter.<\/p>\n<pre class=\" brush:java\">package com.onlinetechvision.item;\r\n\r\nimport java.util.Locale;\r\n\r\nimport org.springframework.batch.item.ItemProcessor;\r\n\r\nimport com.onlinetechvision.user.User;\r\n\r\n\/**\r\n * TestProcessor Class is created to process items.\r\n *\r\n * @author onlinetechvision.com\r\n * @since 10 Dec 2012\r\n * @version 1.0.0\r\n *\r\n *\/\r\npublic class TestProcessor implements ItemProcessor&lt;User, User&gt;  {\r\n\r\n\t\/**\r\n     * Processes items one by one\r\n     *\r\n     * @param User user\r\n     * @return User\r\n     * @throws Exception\r\n     *\r\n     *\/\r\n\t@Override\r\n\tpublic User process(User user) throws Exception {\r\n\t\tuser.setName(user.getName().toUpperCase(Locale.ENGLISH));\r\n\t\tuser.setSurname(user.getSurname().toUpperCase(Locale.ENGLISH));\r\n\t\treturn user;\r\n\t}\r\n\r\n}<\/pre>\n<h2>STEP 12 : CREATE TestWriter IMPL<\/h2>\n<p><strong>TestWriter<\/strong> Class is created by implementing <strong>ItemWriter<\/strong> Interface. This class is called to write items to DB, memory etc\u2026<\/p>\n<pre class=\" brush:java\">package com.onlinetechvision.item;\r\n\r\nimport java.util.List;\r\n\r\nimport org.springframework.batch.item.ItemWriter;\r\n\r\nimport com.onlinetechvision.user.User;\r\nimport com.onlinetechvision.user.service.IUserService;\r\n\r\n\/**\r\n * TestWriter Class is created to write items to DB, memory etc...\r\n *\r\n * @author onlinetechvision.com\r\n * @since 10 Dec 2012\r\n * @version 1.0.0\r\n *\r\n *\/\r\npublic class TestWriter implements ItemWriter&lt;User&gt; {\r\n\r\n\tprivate IUserService userService;\r\n\r\n\t\/**\r\n     * Writes items via list\r\n     *\r\n     * @throws Exception\r\n     *\r\n     *\/\r\n\t@Override\r\n\tpublic void write(List&lt;? extends User&gt; userList) throws Exception {\r\n\t\tfor(User user : userList) {\r\n\t\t\tgetUserService().addUser(user);\r\n\t\t}\r\n\t\tSystem.out.println('User List : ' + getUserService().getUsers());\r\n\t}\r\n\r\n\tpublic IUserService getUserService() {\r\n\t\treturn userService;\r\n\t}\r\n\r\n\tpublic void setUserService(IUserService userService) {\r\n\t\tthis.userService = userService;\r\n\t}\r\n\r\n}<\/pre>\n<h2>STEP 13 : CREATE FailedStepTasklet CLASS<\/h2>\n<p><strong>FailedStepTasklet<\/strong> is created by implementing Tasklet Interface. It illustrates business logic in failed step.<\/p>\n<pre class=\" brush:java\">package com.onlinetechvision.tasklet;\r\n\r\nimport org.apache.log4j.Logger;\r\nimport org.springframework.batch.core.StepContribution;\r\nimport org.springframework.batch.core.scope.context.ChunkContext;\r\nimport org.springframework.batch.core.step.tasklet.Tasklet;\r\nimport org.springframework.batch.repeat.RepeatStatus;\r\n\r\n\/**\r\n * FailedStepTasklet Class illustrates a failed job.\r\n *\r\n * @author onlinetechvision.com\r\n * @since 10 Dec 2012\r\n * @version 1.0.0\r\n *\r\n *\/\r\npublic class FailedStepTasklet implements Tasklet {\r\n\r\n\tprivate static final Logger logger = Logger.getLogger(FailedStepTasklet.class);\r\n\r\n    private String taskResult;\r\n\r\n    \/**\r\n     * Executes FailedStepTasklet\r\n     *\r\n     * @param StepContribution stepContribution\r\n     * @param ChunkContext chunkContext\r\n     * @return RepeatStatus\r\n     * @throws Exception\r\n     *\r\n     *\/\r\n    public RepeatStatus execute(StepContribution stepContribution, ChunkContext chunkContext) throws Exception {\r\n    \tlogger.debug('Task Result : ' + getTaskResult());\r\n    \tthrow new Exception('Error occurred!');\r\n\t}\r\n\r\n\tpublic String getTaskResult() {\r\n\t\treturn taskResult;\r\n\t}\r\n\r\n\tpublic void setTaskResult(String taskResult) {\r\n\t\tthis.taskResult = taskResult;\r\n\t} \r\n\r\n}<\/pre>\n<h2>STEP 14 : CREATE BatchProcessStarter CLASS<\/h2>\n<p><strong>BatchProcessStarter<\/strong> Class is created to launch the jobs. Also, it logs their execution results.<\/p>\n<pre class=\" brush:java\">package com.onlinetechvision.spring.batch;\r\n\r\nimport org.apache.log4j.Logger;\r\nimport org.springframework.batch.core.Job;\r\nimport org.springframework.batch.core.JobExecution;\r\nimport org.springframework.batch.core.JobParametersBuilder;\r\nimport org.springframework.batch.core.JobParametersInvalidException;\r\nimport org.springframework.batch.core.launch.JobLauncher;\r\nimport org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;\r\nimport org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException;\r\nimport org.springframework.batch.core.repository.JobRepository;\r\nimport org.springframework.batch.core.repository.JobRestartException;\r\n\r\n\/**\r\n * BatchProcessStarter Class launches the jobs and logs their execution results.\r\n *\r\n * @author onlinetechvision.com\r\n * @since 10 Dec 2012\r\n * @version 1.0.0\r\n *\r\n *\/\r\npublic class BatchProcessStarter {\r\n\r\n\tprivate static final Logger logger = Logger.getLogger(BatchProcessStarter.class);\r\n\r\n\tprivate Job firstJob;\r\n\tprivate Job secondJob;\r\n\tprivate Job thirdJob;\r\n\tprivate JobLauncher jobLauncher;\r\n\tprivate JobRepository jobRepository;\r\n\r\n\t\/**\r\n     * Starts the jobs and logs their execution results.\r\n     *\r\n     *\/\r\n\tpublic void start() {\r\n\t\tJobExecution jobExecution = null;\r\n\t\tJobParametersBuilder builder = new JobParametersBuilder();\r\n\r\n\t\ttry {\r\n\t\t\tgetJobLauncher().run(getFirstJob(), builder.toJobParameters());\r\n\t\t\tjobExecution = getJobRepository().getLastJobExecution(getFirstJob().getName(), builder.toJobParameters());\r\n\t\t\tlogger.debug(jobExecution.toString());\t\t\t\r\n\r\n\t\t\tgetJobLauncher().run(getSecondJob(), builder.toJobParameters());\r\n\t\t\tjobExecution = getJobRepository().getLastJobExecution(getSecondJob().getName(), builder.toJobParameters());\r\n\t\t\tlogger.debug(jobExecution.toString());\r\n\r\n\t\t\tgetJobLauncher().run(getThirdJob(), builder.toJobParameters());\r\n\t\t\tjobExecution = getJobRepository().getLastJobExecution(getThirdJob().getName(), builder.toJobParameters());\r\n\t\t\tlogger.debug(jobExecution.toString());\r\n\r\n\t\t} catch (JobExecutionAlreadyRunningException\r\n\t\t\t\t\t| JobRestartException\r\n\t\t\t\t\t| JobInstanceAlreadyCompleteException\r\n\t\t\t\t\t| JobParametersInvalidException e) {\r\n\t\t\tlogger.error(e);\r\n\t\t}\r\n\r\n\t}\t\r\n\r\n\tpublic Job getFirstJob() {\r\n\t\treturn firstJob;\r\n\t}\r\n\r\n\tpublic void setFirstJob(Job firstJob) {\r\n\t\tthis.firstJob = firstJob;\r\n\t}\r\n\r\n\tpublic Job getSecondJob() {\r\n\t\treturn secondJob;\r\n\t}\r\n\r\n\tpublic void setSecondJob(Job secondJob) {\r\n\t\tthis.secondJob = secondJob;\r\n\t}\t\r\n\r\n\tpublic Job getThirdJob() {\r\n\t\treturn thirdJob;\r\n\t}\r\n\r\n\tpublic void setThirdJob(Job thirdJob) {\r\n\t\tthis.thirdJob = thirdJob;\r\n\t}\r\n\r\n\tpublic JobLauncher getJobLauncher() {\r\n\t\treturn jobLauncher;\r\n\t}\r\n\r\n\tpublic void setJobLauncher(JobLauncher jobLauncher) {\r\n\t\tthis.jobLauncher = jobLauncher;\r\n\t}\r\n\r\n\tpublic JobRepository getJobRepository() {\r\n\t\treturn jobRepository;\r\n\t}\r\n\r\n\tpublic void setJobRepository(JobRepository jobRepository) {\r\n\t\tthis.jobRepository = jobRepository;\r\n\t}\t\r\n\r\n}<\/pre>\n<h2>STEP 15 : CREATE dataContext.xml <\/h2>\n<p><strong>jdbc.properties<\/strong>, is created. It defines data-source informations and is read via <strong>dataContext.xml<\/strong><\/p>\n<pre class=\" brush:bash\">jdbc.db.driverClassName=com.mysql.jdbc.Driver\r\njdbc.db.url=jdbc:mysql:\/\/localhost:3306\/onlinetechvision\r\njdbc.db.username=root\r\njdbc.db.password=root\r\njdbc.db.initialSize=10\r\njdbc.db.minIdle=3\r\njdbc.db.maxIdle=10\r\njdbc.db.maxActive=10\r\njdbc.db.testWhileIdle=true\r\njdbc.db.testOnBorrow=true\r\njdbc.db.testOnReturn=true\r\njdbc.db.initSQL=SELECT 1 FROM DUAL\r\njdbc.db.validationQuery=SELECT 1 FROM DUAL\r\njdbc.db.timeBetweenEvictionRunsMillis=30000<\/pre>\n<h2>STEP 16 : CREATE dataContext.xml <\/h2>\n<p>Spring Configuration file, <strong>dataContext.xml<\/strong>, is created. It covers dataSource, sessionFactory and transactionManager definitions.<\/p>\n<pre class=\" brush:xml\">&lt;?xml version='1.0' encoding='UTF-8'?&gt;\r\n&lt;beans xmlns='http:\/\/www.springframework.org\/schema\/beans'\r\n\t   xmlns:xsi='http:\/\/www.w3.org\/2001\/XMLSchema-instance'\r\n\t   xmlns:context='http:\/\/www.springframework.org\/schema\/context'\r\n\t   xmlns:p='http:\/\/www.springframework.org\/schema\/p'\r\n\t   xmlns:batch='http:\/\/www.springframework.org\/schema\/batch'\r\n\t   xmlns:tx='http:\/\/www.springframework.org\/schema\/tx'\r\n\t   xsi:schemaLocation='http:\/\/www.springframework.org\/schema\/beans \r\n\r\nhttp:\/\/www.springframework.org\/schema\/beans\/spring-beans-3.0.xsd\r\n\r\nhttp:\/\/www.springframework.org\/schema\/context\r\n\r\nhttp:\/\/www.springframework.org\/schema\/context\/spring-context-3.0.xsd\r\n\r\nhttp:\/\/www.springframework.org\/schema\/batch\r\n\r\nhttp:\/\/www.springframework.org\/schema\/batch\/spring-batch-2.1.xsd\r\n\r\nhttp:\/\/www.springframework.org\/schema\/tx\r\n\r\nhttp:\/\/www.springframework.org\/schema\/tx\/spring-tx-3.0.xsd'&gt;\r\n\r\n    &lt;context:property-placeholder location='classpath:jdbc.properties'\/&gt;\r\n\r\n    &lt;!-- Enable the configuration of transactional behavior based on annotations --&gt;\r\n    &lt;tx:annotation-driven transaction-manager='transactionManager'\/&gt;\r\n\r\n    &lt;!-- Data Source Declaration --&gt;\r\n\t&lt;bean id='dataSource' class='org.apache.tomcat.jdbc.pool.DataSource' destroy-method='close'\r\n\t\t\t    p:driverClassName='${jdbc.db.driverClassName}'\r\n\t\t\t    p:url='${jdbc.db.url}'\r\n\t\t\t    p:username='${jdbc.db.username}'\r\n\t\t\t    p:password='${jdbc.db.password}'\r\n\t\t\t    p:initialSize='${jdbc.db.initialSize}'\r\n\t\t\t    p:minIdle='${jdbc.db.minIdle}'\r\n\t\t\t    p:maxIdle='${jdbc.db.maxIdle}'\r\n\t\t\t    p:maxActive='${jdbc.db.maxActive}'\r\n\t\t\t    p:testWhileIdle='${jdbc.db.testWhileIdle}'\r\n\t\t\t    p:testOnBorrow='${jdbc.db.testOnBorrow}'\r\n\t\t\t    p:testOnReturn='${jdbc.db.testOnReturn}'\r\n\t\t\t    p:initSQL='${jdbc.db.initSQL}'\r\n\t\t\t    p:validationQuery='${jdbc.db.validationQuery}'\r\n\t\t\t    p:timeBetweenEvictionRunsMillis='${jdbc.db.timeBetweenEvictionRunsMillis}'\/&gt;\t\r\n\r\n    &lt;!-- Session Factory Declaration --&gt;\r\n\t&lt;bean id='sessionFactory' class='org.springframework.orm.hibernate4.LocalSessionFactoryBean'&gt;\r\n\t\t&lt;property name='dataSource' ref='dataSource' \/&gt;\r\n\t\t&lt;property name='annotatedClasses'&gt;\r\n\t\t\t&lt;list&gt;\r\n\t\t\t\t&lt;value&gt;com.onlinetechvision.user.User&lt;\/value&gt;\r\n\t\t\t&lt;\/list&gt;\r\n\t\t&lt;\/property&gt;\r\n\t\t&lt;property name='hibernateProperties'&gt;\r\n\t\t\t&lt;props&gt;\r\n\t\t\t\t&lt;prop key='hibernate.dialect'&gt;org.hibernate.dialect.MySQLDialect&lt;\/prop&gt;\r\n\t\t\t\t&lt;prop key='hibernate.show_sql'&gt;true&lt;\/prop&gt;\r\n\t\t\t&lt;\/props&gt;\r\n\t\t&lt;\/property&gt;\r\n\t&lt;\/bean&gt;\r\n\r\n\t&lt;!-- Transaction Manager Declaration --&gt;\r\n    &lt;bean id='transactionManager' class='org.springframework.orm.hibernate4.HibernateTransactionManager'&gt;\r\n       &lt;property name='sessionFactory' ref='sessionFactory'\/&gt;\r\n    &lt;\/bean&gt;\r\n\r\n&lt;\/beans&gt;<\/pre>\n<h2>STEP 17 : CREATE jobContext.xml <\/h2>\n<p>Spring Configuration file, <strong>jobContext.xml<\/strong>, is created. It covers jobRepository, jobLauncher, item reader, item processor, item writer, tasklet and job definitions.<\/p>\n<pre class=\" brush:xml\">&lt;?xml version='1.0' encoding='UTF-8'?&gt;\r\n&lt;beans xmlns='http:\/\/www.springframework.org\/schema\/beans'\r\n\txmlns:xsi='http:\/\/www.w3.org\/2001\/XMLSchema-instance'\r\n\txmlns:batch='http:\/\/www.springframework.org\/schema\/batch'\r\n\txsi:schemaLocation='http:\/\/www.springframework.org\/schema\/beans \r\n\r\nhttp:\/\/www.springframework.org\/schema\/beans\/spring-beans-3.0.xsd\r\n\r\nhttp:\/\/www.springframework.org\/schema\/batch\r\n\r\nhttp:\/\/www.springframework.org\/schema\/batch\/spring-batch-2.1.xsd'&gt;\r\n\r\n    &lt;import resource='dataContext.xml'\/&gt;\r\n\r\n    &lt;!-- jobRepository Declaration --&gt;\r\n    &lt;bean id='jobRepository' class='org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean'&gt;\r\n\t\t&lt;property name='transactionManager' ref='transactionManager' \/&gt;\r\n    &lt;\/bean&gt;\r\n\r\n    &lt;!-- jobLauncher Declaration --&gt;\r\n    &lt;bean id='jobLauncher' class='org.springframework.batch.core.launch.support.SimpleJobLauncher' &gt;\r\n        &lt;property name='jobRepository' ref='jobRepository'\/&gt;\r\n    &lt;\/bean&gt;\r\n\r\n    &lt;!-- Reader Bean Declarations --&gt;\r\n    &lt;bean id='firstTestReader' class='com.onlinetechvision.item.TestReader'&gt;\r\n    \t&lt;property name='maxIndex' value='2'\/&gt;\r\n\t    &lt;property name='namePrefix' value='firstname'\/&gt;\r\n\t    &lt;property name='surnamePrefix' value='firstsurname'\/&gt;\r\n    &lt;\/bean&gt;\r\n\r\n    &lt;bean id='secondTestReader' class='com.onlinetechvision.item.TestReader'&gt;\r\n        &lt;property name='maxIndex' value='2'\/&gt;\r\n\t    &lt;property name='namePrefix' value='secondname'\/&gt;\r\n\t    &lt;property name='surnamePrefix' value='secondsurname'\/&gt;\r\n    &lt;\/bean&gt;\r\n\r\n    &lt;bean id='thirdTestReader' class='com.onlinetechvision.item.TestReader'&gt;\r\n        &lt;property name='maxIndex' value='3'\/&gt;\r\n\t    &lt;property name='namePrefix' value='thirdname'\/&gt;\r\n\t    &lt;property name='surnamePrefix' value='thirdsurname'\/&gt;\r\n    &lt;\/bean&gt;\r\n\r\n    &lt;bean id='fourthTestReader' class='com.onlinetechvision.item.TestReader'&gt;\r\n        &lt;property name='maxIndex' value='3'\/&gt;\r\n\t    &lt;property name='namePrefix' value='fourthname'\/&gt;\r\n\t    &lt;property name='surnamePrefix' value='fourthsurname'\/&gt;\r\n    &lt;\/bean&gt;\r\n\r\n    &lt;bean id='fifthTestReader' class='com.onlinetechvision.item.TestReader'&gt;\r\n        &lt;property name='maxIndex' value='3'\/&gt;\r\n\t    &lt;property name='namePrefix' value='fifthname'\/&gt;\r\n\t    &lt;property name='surnamePrefix' value='fifthsurname'\/&gt;\r\n    &lt;\/bean&gt;\r\n\r\n    &lt;bean id='failedCaseTestReader' class='com.onlinetechvision.item.FailedCaseTestReader'&gt;\r\n        &lt;property name='maxIndex' value='1'\/&gt;\r\n\t    &lt;property name='namePrefix' value='failedcasename'\/&gt;\r\n\t    &lt;property name='surnamePrefix' value='failedcasesurname'\/&gt;\r\n    &lt;\/bean&gt;\r\n\r\n    &lt;!-- Processor Bean Declaration --&gt;\r\n    &lt;bean id='testProcessor' class='com.onlinetechvision.item.TestProcessor' \/&gt;\r\n\r\n    &lt;!-- Writer Bean Declaration --&gt;\r\n    &lt;bean id='testWriter' class='com.onlinetechvision.item.TestWriter' &gt;\r\n    \t&lt;property name='userService' ref='userService'\/&gt;\r\n    &lt;\/bean&gt;\r\n\r\n    &lt;!-- Failed Step Tasklet Declaration --&gt;\r\n    &lt;bean id='failedStepTasklet' class='com.onlinetechvision.tasklet.FailedStepTasklet'&gt;\r\n        &lt;property name='taskResult'  value='Error occurred!' \/&gt;\r\n    &lt;\/bean&gt; \r\n\r\n    &lt;!-- Batch Job Declarations --&gt;\r\n    &lt;batch:job id='firstJob'&gt;\r\n\t\t&lt;batch:step id='firstStep' next='secondStep'&gt;\r\n\t\t\t&lt;batch:tasklet&gt;\r\n\t\t\t\t&lt;batch:chunk reader='firstTestReader' processor='testProcessor' writer='testWriter' commit-interval='2'\/&gt;\r\n\t\t\t&lt;\/batch:tasklet&gt;\r\n\t\t&lt;\/batch:step&gt;\r\n\t\t&lt;batch:step id='secondStep'&gt;\r\n\t\t\t&lt;batch:tasklet&gt;\r\n\t\t\t\t&lt;batch:chunk reader='secondTestReader' processor='testProcessor' writer='testWriter' commit-interval='2'\/&gt;\r\n\t\t\t&lt;\/batch:tasklet&gt;\r\n\t\t&lt;\/batch:step&gt;\r\n\t&lt;\/batch:job&gt;\r\n\r\n\t&lt;batch:job id='secondJob'&gt;\r\n\t\t&lt;batch:step id='thirdStep'&gt;\r\n\t\t\t&lt;batch:tasklet&gt;\r\n\t\t\t\t&lt;batch:chunk reader='thirdTestReader' processor='testProcessor' writer='testWriter' commit-interval='2'\/&gt;\r\n\t\t\t&lt;\/batch:tasklet&gt;\r\n\t\t\t&lt;batch:next on='*' to='fourthStep' \/&gt;\r\n\t        &lt;batch:next on='FAILED' to='firstFailedStep' \/&gt;\r\n\t    &lt;\/batch:step&gt;\r\n\t    &lt;batch:step id='fourthStep'&gt;\r\n\t\t\t&lt;batch:tasklet&gt;\r\n\t\t\t\t&lt;batch:chunk reader='fourthTestReader' processor='testProcessor' writer='testWriter' commit-interval='2'\/&gt;\r\n\t\t\t&lt;\/batch:tasklet&gt;\r\n\t\t&lt;\/batch:step&gt;\r\n\t\t&lt;batch:step id='firstFailedStep'&gt;\r\n            &lt;batch:tasklet ref='failedStepTasklet' \/&gt;\r\n        &lt;\/batch:step&gt;\r\n\t&lt;\/batch:job&gt;\r\n\r\n\t&lt;batch:job id='thirdJob'&gt;\r\n\t\t&lt;batch:step id='fifthStep'&gt;\r\n\t\t\t&lt;batch:tasklet&gt;\r\n\t\t\t\t&lt;batch:chunk reader='failedCaseTestReader' processor='testProcessor' writer='testWriter' commit-interval='2'\/&gt;\r\n\t\t\t&lt;\/batch:tasklet&gt;\r\n\t\t\t&lt;batch:next on='*' to='sixthStep' \/&gt;\r\n\t        &lt;batch:next on='FAILED' to='secondFailedStep' \/&gt;\r\n\t    &lt;\/batch:step&gt;\r\n\t    &lt;batch:step id='sixthStep'&gt;\r\n\t\t\t&lt;batch:tasklet&gt;\r\n\t\t\t\t&lt;batch:chunk reader='fifthTestReader' processor='testProcessor' writer='testWriter' commit-interval='2'\/&gt;\r\n\t\t\t&lt;\/batch:tasklet&gt;\r\n\t\t&lt;\/batch:step&gt;\r\n\t\t&lt;batch:step id='secondFailedStep'&gt;\r\n            &lt;batch:tasklet ref='failedStepTasklet' \/&gt;\r\n        &lt;\/batch:step&gt;\r\n\t&lt;\/batch:job&gt;\r\n\r\n&lt;\/beans&gt;<\/pre>\n<h2>STEP 18 : CREATE applicationContext.xml <\/h2>\n<p>Spring Configuration file, <strong>applicationContext.xml<\/strong>, is created. It covers bean definitions.<\/p>\n<pre class=\" brush:xml\">&lt;?xml version='1.0' encoding='UTF-8'?&gt;\r\n&lt;beans xmlns='http:\/\/www.springframework.org\/schema\/beans'\r\n\txmlns:xsi='http:\/\/www.w3.org\/2001\/XMLSchema-instance'\r\n\txmlns:batch='http:\/\/www.springframework.org\/schema\/batch'\r\n\txsi:schemaLocation='http:\/\/www.springframework.org\/schema\/beans \r\n\r\nhttp:\/\/www.springframework.org\/schema\/beans\/spring-beans-3.0.xsd\r\n\r\nhttp:\/\/www.springframework.org\/schema\/batch\r\n\r\nhttp:\/\/www.springframework.org\/schema\/batch\/spring-batch-2.1.xsd'&gt;\r\n\r\n\t&lt;import resource='jobContext.xml'\/&gt;\r\n\r\n    &lt;!-- User DAO Declaration --&gt;\r\n\t&lt;bean id='userDAO' class='com.onlinetechvision.user.dao.UserDAO'&gt;\r\n\t\t&lt;property name='sessionFactory' ref='sessionFactory' \/&gt;\r\n\t&lt;\/bean&gt;\r\n\r\n\t&lt;!-- User Service Declaration --&gt;\r\n\t&lt;bean id='userService' class='com.onlinetechvision.user.service.UserService'&gt;\r\n\t\t&lt;property name='userDAO' ref='userDAO' \/&gt;\r\n\t&lt;\/bean&gt;\t\r\n\r\n\t&lt;!-- BatchProcessStarter Declaration --&gt;\r\n\t&lt;bean id='batchProcessStarter' class='com.onlinetechvision.spring.batch.BatchProcessStarter'&gt;\r\n\t\t&lt;property name='jobLauncher' ref='jobLauncher'\/&gt;\r\n\t\t&lt;property name='jobRepository' ref='jobRepository'\/&gt;\r\n\t\t&lt;property name='firstJob' ref='firstJob'\/&gt;\r\n\t\t&lt;property name='secondJob' ref='secondJob'\/&gt;\r\n\t\t&lt;property name='thirdJob' ref='thirdJob'\/&gt;\r\n    &lt;\/bean&gt; \r\n\r\n&lt;\/beans&gt;<\/pre>\n<h2>STEP 19 : CREATE Application CLASS<\/h2>\n<p>Application Class is created to run the application.<\/p>\n<pre class=\" brush:java\">package com.onlinetechvision.exe;\r\n\r\nimport org.springframework.context.ApplicationContext;\r\nimport org.springframework.context.support.ClassPathXmlApplicationContext;\r\n\r\nimport com.onlinetechvision.spring.batch.BatchProcessStarter;\r\n\r\n\/**\r\n * Application Class starts the application.\r\n *\r\n * @author onlinetechvision.com\r\n * @since 10 Dec 2012\r\n * @version 1.0.0\r\n *\r\n *\/\r\npublic class Application {\r\n\r\n\t\/**\r\n     * Starts the application\r\n     *\r\n     * @param  String[] args\r\n     *\r\n     *\/\r\n\tpublic static void main(String[] args) {\r\n\t\tApplicationContext appContext = new ClassPathXmlApplicationContext('applicationContext.xml');\r\n\t\tBatchProcessStarter batchProcessStarter = (BatchProcessStarter)appContext.getBean('batchProcessStarter');\r\n\t\tbatchProcessStarter.start();\r\n\t}\r\n\r\n}<\/pre>\n<h2>STEP 20 : BUILD PROJECT<\/h2>\n<p>After <strong>OTV_SpringBatch_Chunk_Oriented_Processing<\/strong> Project is built, <strong>OTV_SpringBatch_Chunk_Oriented_Processing-0.0.1-SNAPSHOT.jar<\/strong> will be created.<\/p>\n<h2>STEP 21 : RUN PROJECT<\/h2>\n<p>After created <strong>OTV_SpringBatch_Chunk_Oriented_Processing-0.0.1-SNAPSHOT.jar<\/strong> file is run, the following database and console output logs will be shown :<\/p>\n<p><strong>Database screenshot :<\/strong><\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/Result_Table2.png\"><img decoding=\"async\" class=\"aligncenter\" title=\"Result_Table\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/Result_Table2.png\" alt=\"\" width=\"595\" height=\"287\" \/><\/a><\/p>\n<p><strong>First Job\u2019 s console output :<\/strong><\/p>\n<pre class=\" brush:bash\">16.12.2012 19:30:41  INFO (SimpleJobLauncher.java:118) - Job: [FlowJob: [name=firstJob]] launched with the following parameters: [{}]\r\n\r\n16.12.2012 19:30:41 DEBUG (AbstractJob.java:278) - Job execution starting: JobExecution: id=0, version=0, startTime=null, endTime=null, lastUpdated=Sun Dec 16 19:30:41 GMT 2012, status=STARTING, exitStatus=exitCode=UNKNOWN;exitDescription=, job=[JobInstance: id=0, version=0, JobParameters=[{}], Job=[firstJob]]\r\n\r\nUser List : [id : 181, name : FIRSTNAME_0, surname : FIRSTSURNAME_0, id : 182, name : FIRSTNAME_1, surname : FIRSTSURNAME_1, id : 183, name : FIRSTNAME_2, surname : FIRSTSURNAME_2, id : 184, name : SECONDNAME_0, surname : SECONDSURNAME_0, id : 185, name : SECONDNAME_1, surname : SECONDSURNAME_1, id : 186, name : SECONDNAME_2, surname : SECONDSURNAME_2]\r\n\r\n16.12.2012 19:30:42 DEBUG (BatchProcessStarter.java:43) - JobExecution: id=0, version=2, startTime=Sun Dec 16 19:30:41 GMT 2012, endTime=Sun Dec 16 19:30:42 GMT 2012, lastUpdated=Sun Dec 16 19:30:42 GMT 2012, status=COMPLETED, exitStatus=exitCode=COMPLETED;exitDescription=, job=[JobInstance: id=0, version=0, JobParameters=[{}], Job=[firstJob]]<\/pre>\n<p><strong>Second Job\u2019 s console output :<\/strong><\/p>\n<pre class=\" brush:bash\">16.12.2012 19:30:42  INFO (SimpleJobLauncher.java:118) - Job: [FlowJob: [name=secondJob]] launched with the following parameters: [{}]\r\n\r\n16.12.2012 19:30:42 DEBUG (AbstractJob.java:278) - Job execution starting: JobExecution: id=1, version=0, startTime=null, endTime=null, lastUpdated=Sun Dec 16 19:30:42 GMT 2012, status=STARTING, exitStatus=exitCode=UNKNOWN;exitDescription=, job=[JobInstance: id=1, version=0, JobParameters=[{}], Job=[secondJob]]\r\n\r\nUser List : [id : 181, name : FIRSTNAME_0, surname : FIRSTSURNAME_0, id : 182, name : FIRSTNAME_1, surname : FIRSTSURNAME_1, id : 183, name : FIRSTNAME_2, surname : FIRSTSURNAME_2, id : 184, name : SECONDNAME_0, surname : SECONDSURNAME_0, id : 185, name : SECONDNAME_1, surname : SECONDSURNAME_1, id : 186, name : SECONDNAME_2, surname : SECONDSURNAME_2, id : 187, name : THIRDNAME_0, surname : THIRDSURNAME_0, id : 188, name : THIRDNAME_1, surname : THIRDSURNAME_1, id : 189, name : THIRDNAME_2, surname : THIRDSURNAME_2, id : 190, name : THIRDNAME_3, surname : THIRDSURNAME_3, id : 191, name : FOURTHNAME_0, surname : FOURTHSURNAME_0, id : 192, name : FOURTHNAME_1, surname : FOURTHSURNAME_1, id : 193, name : FOURTHNAME_2, surname : FOURTHSURNAME_2, id : 194, name : FOURTHNAME_3, surname : FOURTHSURNAME_3]\r\n\r\n16.12.2012 19:30:42 DEBUG (BatchProcessStarter.java:47) - JobExecution: id=1, version=2, startTime=Sun Dec 16 19:30:42 GMT 2012, endTime=Sun Dec 16 19:30:42 GMT 2012, lastUpdated=Sun Dec 16 19:30:42 GMT 2012, status=COMPLETED, exitStatus=exitCode=COMPLETED;exitDescription=, job=[JobInstance: id=1, version=0, JobParameters=[{}], Job=[secondJob]]<\/pre>\n<p><strong>Third Job\u2019 s console output :<\/strong><\/p>\n<pre class=\" brush:bash\">16.12.2012 19:30:42  INFO (SimpleJobLauncher.java:118) - Job: [FlowJob: [name=thirdJob]] launched with the following parameters: [{}]\r\n\r\n16.12.2012 19:30:42 DEBUG (AbstractJob.java:278) - Job execution starting: JobExecution: id=2, version=0, startTime=null, endTime=null, lastUpdated=Sun Dec 16 19:30:42 GMT 2012, status=STARTING, exitStatus=exitCode=UNKNOWN;exitDescription=, job=[JobInstance: id=2, version=0, JobParameters=[{}], Job=[thirdJob]]\r\n\r\n16.12.2012 19:30:42 DEBUG (TransactionTemplate.java:159) - Initiating transaction rollback on application exception\r\norg.springframework.batch.repeat.RepeatException: Exception in batch process; nested exception is java.lang.Exception: Unexpected Error!\r\n...\r\n\r\n16.12.2012 19:30:43 DEBUG (BatchProcessStarter.java:51) - JobExecution: id=2, version=2, startTime=Sun Dec 16 19:30:42 GMT 2012, endTime=Sun Dec 16 19:30:43 GMT 2012, lastUpdated=Sun Dec 16 19:30:43 GMT 2012, status=FAILED, exitStatus=exitCode=FAILED;exitDescription=, job=[JobInstance: id=2, version=0, JobParameters=[{}], Job=[thirdJob]]<\/pre>\n<p><strong>STEP 22 : DOWNLOAD<\/strong><br \/>\n<strong><a title=\"https:\/\/github.com\/erenavsarogullari\/OTV_SpringBatch_Chunk_Oriented_Processing\" href=\"https:\/\/github.com\/erenavsarogullari\/OTV_SpringBatch_Chunk_Oriented_Processing\" target=\"_blank\">https:\/\/github.com\/erenavsarogullari\/OTV_SpringBatch_Chunk_Oriented_Processing<\/a><\/strong><\/p>\n<h4>Resources:<\/h4>\n<p><strong><a title=\"Chunk Oriented Processing in Spring Batch\" href=\"http:\/\/static.springsource.org\/spring-batch\/reference\/index.html\" target=\"_blank\">Chunk Oriented Processing in Spring Batch<\/a><\/strong><br \/>\n&nbsp;<\/p>\n<p><strong><em>Reference: <\/em><\/strong><a href=\"http:\/\/www.onlinetechvision.com\/?p=695\">Chunk Oriented Processing in Spring Batch<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/p\/jcg.html\">JCG partner<\/a> Eren Avsarogullari at the <a href=\"http:\/\/www.onlinetechvision.com\/\">Online Technology Vision<\/a> blog.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Big Data Sets\u2019 Processing is one of the most important problem in the software world. Spring Batch is a lightweight and robust batch framework to process the data sets. Spring Batch Framework offers \u2018TaskletStep Oriented\u2019 and \u2018Chunk Oriented\u2019 processing style. In this article, Chunk Oriented Processing Model is explained. Also, TaskletStep Oriented Processing in Spring &hellip;<\/p>\n","protected":false},"author":158,"featured_media":240,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[30,691],"class_list":["post-6014","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-spring","tag-spring-batch"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Chunk Oriented Processing in Spring Batch<\/title>\n<meta name=\"description\" content=\"Big Data Sets\u2019 Processing is one of the most important problem in the software world. Spring Batch is a lightweight and robust batch framework to process\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2012\/12\/chunk-oriented-processing-in-spring-batch.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Chunk Oriented Processing in Spring Batch\" \/>\n<meta property=\"og:description\" content=\"Big Data Sets\u2019 Processing is one of the most important problem in the software world. Spring Batch is a lightweight and robust batch framework to process\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2012\/12\/chunk-oriented-processing-in-spring-batch.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2012-12-22T13:00:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Eren Avsarogullari\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Eren Avsarogullari\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"23 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/chunk-oriented-processing-in-spring-batch.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/chunk-oriented-processing-in-spring-batch.html\"},\"author\":{\"name\":\"Eren Avsarogullari\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/65e6e57c730ae5ade3adbadd483553bd\"},\"headline\":\"Chunk Oriented Processing in Spring Batch\",\"datePublished\":\"2012-12-22T13:00:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/chunk-oriented-processing-in-spring-batch.html\"},\"wordCount\":947,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/chunk-oriented-processing-in-spring-batch.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"keywords\":[\"Spring\",\"Spring Batch\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/chunk-oriented-processing-in-spring-batch.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/chunk-oriented-processing-in-spring-batch.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/chunk-oriented-processing-in-spring-batch.html\",\"name\":\"Chunk Oriented Processing in Spring Batch\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/chunk-oriented-processing-in-spring-batch.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/chunk-oriented-processing-in-spring-batch.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"datePublished\":\"2012-12-22T13:00:29+00:00\",\"description\":\"Big Data Sets\u2019 Processing is one of the most important problem in the software world. Spring Batch is a lightweight and robust batch framework to process\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/chunk-oriented-processing-in-spring-batch.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/chunk-oriented-processing-in-spring-batch.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/chunk-oriented-processing-in-spring-batch.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"spring-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/chunk-oriented-processing-in-spring-batch.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Chunk Oriented Processing in Spring Batch\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/65e6e57c730ae5ade3adbadd483553bd\",\"name\":\"Eren Avsarogullari\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d90f2a1d9c2144dd49935d6c84d5c3aa0832793a522148f397bda79bd8e04c16?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d90f2a1d9c2144dd49935d6c84d5c3aa0832793a522148f397bda79bd8e04c16?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d90f2a1d9c2144dd49935d6c84d5c3aa0832793a522148f397bda79bd8e04c16?s=96&d=mm&r=g\",\"caption\":\"Eren Avsarogullari\"},\"sameAs\":[\"http:\\\/\\\/www.onlinetechvision.com\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/Eren-Avsarogullari\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Chunk Oriented Processing in Spring Batch","description":"Big Data Sets\u2019 Processing is one of the most important problem in the software world. Spring Batch is a lightweight and robust batch framework to process","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2012\/12\/chunk-oriented-processing-in-spring-batch.html","og_locale":"en_US","og_type":"article","og_title":"Chunk Oriented Processing in Spring Batch","og_description":"Big Data Sets\u2019 Processing is one of the most important problem in the software world. Spring Batch is a lightweight and robust batch framework to process","og_url":"https:\/\/www.javacodegeeks.com\/2012\/12\/chunk-oriented-processing-in-spring-batch.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2012-12-22T13:00:29+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","type":"image\/jpeg"}],"author":"Eren Avsarogullari","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Eren Avsarogullari","Est. reading time":"23 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/chunk-oriented-processing-in-spring-batch.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/chunk-oriented-processing-in-spring-batch.html"},"author":{"name":"Eren Avsarogullari","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/65e6e57c730ae5ade3adbadd483553bd"},"headline":"Chunk Oriented Processing in Spring Batch","datePublished":"2012-12-22T13:00:29+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/chunk-oriented-processing-in-spring-batch.html"},"wordCount":947,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/chunk-oriented-processing-in-spring-batch.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","keywords":["Spring","Spring Batch"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2012\/12\/chunk-oriented-processing-in-spring-batch.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/chunk-oriented-processing-in-spring-batch.html","url":"https:\/\/www.javacodegeeks.com\/2012\/12\/chunk-oriented-processing-in-spring-batch.html","name":"Chunk Oriented Processing in Spring Batch","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/chunk-oriented-processing-in-spring-batch.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/chunk-oriented-processing-in-spring-batch.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","datePublished":"2012-12-22T13:00:29+00:00","description":"Big Data Sets\u2019 Processing is one of the most important problem in the software world. Spring Batch is a lightweight and robust batch framework to process","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/chunk-oriented-processing-in-spring-batch.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2012\/12\/chunk-oriented-processing-in-spring-batch.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/chunk-oriented-processing-in-spring-batch.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","width":150,"height":150,"caption":"spring-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/chunk-oriented-processing-in-spring-batch.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Chunk Oriented Processing in Spring Batch"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/65e6e57c730ae5ade3adbadd483553bd","name":"Eren Avsarogullari","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/d90f2a1d9c2144dd49935d6c84d5c3aa0832793a522148f397bda79bd8e04c16?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/d90f2a1d9c2144dd49935d6c84d5c3aa0832793a522148f397bda79bd8e04c16?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d90f2a1d9c2144dd49935d6c84d5c3aa0832793a522148f397bda79bd8e04c16?s=96&d=mm&r=g","caption":"Eren Avsarogullari"},"sameAs":["http:\/\/www.onlinetechvision.com\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/Eren-Avsarogullari"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/6014","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/158"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=6014"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/6014\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/240"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=6014"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=6014"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=6014"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}