Announcement Announcement Module
No announcement yet.
TasketStep get rolled back and came out of excute method repeat continuable Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • TasketStep get rolled back and came out of excute method repeat continuable

    Per documentation TaskletStep execute a new transaction for each iteration if we set the repeat status as RepeatStatus.CONTINUABLE. But when I do prcessing the 10 records for a 5th record if a transaction rolled back all records are getting rolled back and the control is going to afterStep() method even if I set the RepeatStatus.CONTINUABLE. can some one help us to give more details.

    Applicaiton is throwing the HBEServiceException and is included in no-rollback-exception-classes. But still we are facing the issue of roll back of all records

    public RepeatStatus execute(StepContribution arg0, ChunkContext chunkContext) throws HBEServiceException {
    if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("Entering MedicaidRenewalJob::executeJob");

    }catch(Exceptio e){
    return RepeatStatus.CONTINUABLE;


    Job XML:

    <batch:job id="MedicaidRenewalBatch" restartable="true" >
    <batch:step id="MedicaidRenewalJob" >
    <batch:tasklet ref="MedicaidRenewalTasklet" >
    <batch:include class="java.lang.Throwable" />
    <batch:include class="java.lang.Exception" />
    <batch:include class="com.hbe.wa.framework.exception.HBEServiceException" />
    <batch:include class="" />
    <batch:include class="org.hibernate.HibernateException"/>


    <bean id="MedicaidRenewalTasklet" class="com.hbe.wa.batch.eligibility.MedicaidRenewa lJob"
    <constructor-arg ref="eligibilityRenewService"/>
    <constructor-arg ref="referenceDataService"/>
    <property name="applicationService" ref="applicationService"/>
    <property name="renewalService" ref="renewalService"/>
    <property name="userService" ref="userService"/>
    <property name="correspondenceService" ref="correspondenceService"/>
    <property name="eligibilityDeterminationWebService" ref="eligibilityDeterminationWebService"/>
    <property name="batchRecordExceptionsService" ref="batchRecordExceptionsService" />


    <tx:advice id="txEligibilityDeterminationWebService"
    <tx:method name="callNonAffordabilityOpaRules" propagation="SUPPORTS"
    rollback-for="com.hbe.wa.framework.exception.HBEServiceExce ption" />
    <tx:method name="determineAPTCAmount" propagation="REQUIRED"
    rollback-for="com.hbe.wa.framework.exception.HBEServiceExce ption" />
    <tx:method name="determineAffordabilityEligibility" propagation="REQUIRED"
    rollback-for="com.hbe.wa.framework.exception.HBEServiceExce ption"/>
    <tx:method name="renewNonAffordabilityApplications" propagation="REQUIRED"/>
    <tx:method name="batchEligibilityServiceCall" propagation="SUPPORTS" no-rollback-for="com.hbe.wa.framework.exception.HBEServiceExce ption" />
    <tx:method name="determineMinimumEssentialCoverage" propagation="REQUIRED"/>

    In the above code batchEligibilityServiceCall() calls the determineAffordabilityEligibility() method which make transaction as rolled back. But batchEligibilityServiceCall() has marked as no-rollback. But still I am getting the
    error as "Transaction is marked as rollback".

  • #2
    Is the exception escaping the tasklet? I see you have no-rollback exceptions configured but those only apply to exceptions that get back to the framework. Any exception that you throw and catch yourself has no impact on that.

    Also as a note, please use the code formatting when posting code. It makes it much easier to read.


    • #3
      I am able to catch exception in catch Block. After that the control comes to RepeatStatus.CONTINUABLE; rather than repeat the execute method again, it goes to afterStep() and terminate the job.
      The HBEServiceException extends from the Exception class. Please provide more explanation on framework exceptions? is it Spding framework exceptions or any other java exceptions..?
      What are the next steps to retains the control in the same bath job rather than terminating the job.

      Next time onwards I will keep formatted code. thanks for the response.


      • #4
        If you are catching the exception within the tasklet, the framework doesn't come into play with the exception. Only non-caught exceptions are handled by the framework. Do you have a unit test to demonstrate the issue?


        • #5
          I do not have Unit test case. But why the control going to afterStep() method rahter than the execute method to execute the rest of the records.