Announcement Announcement Module
Collapse
No announcement yet.
<batch:step>: no "transaction-attribute"? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • <batch:step>: no "transaction-attribute"?

    I'm trying to setup a non-transactional tasklet using MethodInvokingTaskletAdapter in a simple definition like this:

    Code:
        <batch:job id="indexUpdater">
            <batch:step id="updateIndexes" tasklet="indexUpdaterTasklet"/>
        </batch:job>
    
      <bean id="indexUpdaterTasklet" class="org.springframework.batch.core.step.tasklet.MethodInvokingTaskletAdapter">
            <property name="targetObject" ref="indexUpdaterService"/>
    
    [...]
    Unfortunately, I cannot directly set the required "transaction-attribute" on a <batch:step>-element. Using <batch:tasklet> is not an option, since I don't have any readers/writers.

    Would the addition of this attribute make sense or is there an other preferred way of achieving this?

    Thanks,
    Yann

  • #2
    I've created the following issue to track this: http://jira.springframework.org/browse/BATCH-1131

    Comment


    • #3
      What do you mean by a non-transactional tasklet? I guess you could provide your own implementation of AbstractStep.

      Comment


      • #4
        Indeed, I figured a solution using plain <bean>-style configuration with TaskletStep and setting transactionAttribute directly.

        Comment


        • #5
          Originally posted by yannc76 View Post
          Indeed, I figured a solution using plain <bean>-style configuration with TaskletStep and setting transactionAttribute directly.
          I have the same problem and I solved it injecting a "ResourcelessTransactionManager" to my non-transactional tasklet:

          Code:
          <bean id="resourcelessTransactionManager" class="org.springframework.batch.support.transaction.ResourcelessTransactionManager" />
          
          <batch:tasklet ref="myTasklet" start-limit="1" transaction-manager="resourcelessTransactionManager" />
          Last edited by vesperaba; Jul 12th, 2012, 05:40 AM. Reason: I found a soluction

          Comment


          • #6
            Another way to do it

            I found another way to do it:

            Code:
            <batch:tasklet ref="myTasklet">
                <batch:transaction-attributes propagation="NOT_SUPPORTED" /> 
            </batch:tasklet>

            Comment

            Working...
            X