camel-jdbc transaction does not work as expected
Issue
Transaction timeout does not work as expected with following camel route, and insert queries are committed to Postgres DB.
<bean class="org.springframework.jdbc.datasource.DataSourceTransactionManager" id="TxManager">
<property name="dataSource" ref="postgresqlDatasource" />
<property name="defaultTimeout" value="4" />
</bean>
<bean class="org.apache.camel.spring.spi.SpringTransactionPolicy" id="PROPAGATION_REQUIRED">
<property name="transactionManager" ref="TxManager" />
<property name="propagationBehaviorName" value="PROPAGATION_REQUIRED" />
</bean>
<camelContext allowUseOriginalMessage="false" id="reproducer" xmlns="http://camel.apache.org/schema/blueprint">
<route id="testCommit" trace="false">
<from id="_from1" uri="timer:t1?repeatCount=1" />
<transacted id="_transacted1" ref="PROPAGATION_REQUIRED" />
<transform>
<simple> INSERT INTO TESTCOMMIT(key) VALUES('1'); </simple>
</transform>
<to id="_to1" uri="jdbc:postgresqlDatasource?resetAutoCommit=false&transacted=true" />
<to id="_to1" uri="exec:sleep?args=60" />
<transform>
<simple> INSERT INTO TESTCOMMIT(key) VALUES('2'); </simple>
</transform>
<to id="_to2" uri="jdbc:postgresqlDatasource?resetAutoCommit=false&transacted=true" />
</route>
</camelContext>
Environment
- Red Hat Fuse
- 7.3.1
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.