Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Forcing a transaction to commit (using Spring XML)?

$
0
0
Using camel 10.0.3 with Spring 3.1.

Doing workflow processing, I have two routes. One pulls a message from a
JMS queue, processes it and then puts a new message on a different JMS queue
(where the new message continues to be processed).

I DONT want the processing of the new message (pulled from the second queue)
to impact the original transaction in any way (e.g. the first transaction
shouldn't wait and shouldn't roll back as a result of the second)

I'm using different transaction managers on both JMS queues (since I have
different connection factories / different connection urls). However, they
are both org.springframework.jms.connection.jmsTransactionManager.

I have the transaction policy on the 2nd route as PROPAGATION_REQUIRES_NEW,
but the first transaction doesn't get commited if there is an issue in the
secondary processing. I want it to be commited as soon as it successfully
places the new message on the second queue.

What is the correct way to implement this (in Spring XML)?

Here is the gist of my routes:

<route id="firstQueue">
<from uri"activemqMain:queue:inBound?concurrentConsumers=10" />
<transacted ref="PROPAGATION_REQUIRES_NEW"/>
<bean ref="myBean" method="doProcessing" />
<to uri="activemqMainProducer:queue:stepTwo" />
</route>

<route id="stepTwoQueue">
<from uri"activemqMain:queue:stepTwo?concurrentConsumers=10" />
<transacted ref="PROPAGATION_REQUIRES_NEW"/>
<bean ref="myBean" method="doStepTwoProcessing" />
<to uri="direct:doStepThreeProcessing"/>
</route>

Viewing all articles
Browse latest Browse all 5648

Trending Articles