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

  • yannc76
    started a topic <batch:step>: no "transaction-attribute"?

    <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

  • vesperaba
    replied
    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>

    Leave a comment:


  • vesperaba
    replied
    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

    Leave a comment:


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

    Leave a comment:


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

    Leave a comment:


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

    Leave a comment:

Working...
X