Announcement Announcement Module
Collapse
No announcement yet.
Concurrent Processing Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Concurrent Processing

    Hi

    How to do parallel processing for the following job?
    please let me know how to change the configuration


    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns="http://www.springframework.org/schema/p"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-2.5.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schem...ng-aop-2.5.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

    <description>Example for Hibernate integration.</description>

    <bean id="hibernateJob" parent="simpleJob">
    <!-- set restartable=false so that this job can be used by more than one test -->
    <property name="restartable" value="true" />
    <property name="steps">
    <bean id="step1" parent="simpleStep">
    <!--<property name="skipLimit" value="0" />-->
    <property name="itemReader" ref="hibernateItemReader" />
    <property name="itemWriter" ref="hibernateItemWriter" />
    <property name="commitInterval" value="1" />
    <!--<property name="skippableExceptionClasses" value="java.lang.Exception"/>-->
    <property name="listeners" ref="stepListener" />
    <property name="exceptionHandler" ref="stepListener" />
    </bean>
    </property>
    </bean>


    <!-- This is a framework class that needs a delegate and also needs to be registered as a RepeatInterceptor in the chunk -->
    <bean id="hibernateItemWriter"
    class="org.springframework.batch.item.database.Hib ernateAwareItemWriter">
    <property name="sessionFactory" ref="sessionFactory" />
    <property name="delegate" ref="hibernateCreditWriter" />
    </bean>

    <bean id="hibernateCreditWriter"
    class="com.met.ib.upi.batch.item.processor.Custome rCreditProcessor">
    <property name="customerCreditDao" ref="customerCreditDao" />
    <property name="hibernateBO" ref="hibernateBO"/>
    </bean>
    <bean id="hibernateBO"
    class="com.met.ib.upi.batch.bo.HibernateTestBO">
    </bean>
    <bean id="customerCreditDao"
    class="com.met.ib.upi.batch.dao.HibernateCreditWri ter">
    <property name="sessionFactory" ref="sessionFactory" />
    </bean>

    <bean id="hibernateItemReader"
    class="org.springframework.batch.item.database.Hib ernateCursorItemReader">
    <property name="queryString" value="from TempTable" />
    <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    <bean id="stepListener"
    class="com.met.ib.upi.batch.exceptionHandler.StepE xceptionHandler">
    </bean>
    </beans>

  • #2
    The HibernateCursorItemReader is not thread safe, so you can't run in multiple threads by just a change to the configuration. You need to implement the item reader in a thread safe way (look at StagingItemReader for an example of how to do that). It isn't a simple generalisation since it will mean that the data has to contain the process indicator (maybe you have to add a column to the input table for this).

    (Please use [code][/code] tags to post code and stack traces.)

    Comment


    • #3
      Is there any other way to implement parallel processing just by changing the configuration?
      If its not possible, is there any example of StagingItemReader implementation with Hibernate?

      Comment


      • #4
        Standalone application

        Hi,

        I want to create a standalone application in my Spring project. Everytime the actual flow is happening, controller goes to Handler and the it's calling Dao class and retrieve the data and return to contoller's Model and View to its jsp.

        I want to create a standalone application directly connect the server. Everytime don't want to do the actual workflow.

        Please assist me in this and guide me anyone.

        Comment

        Working...
        X