activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher G. Stach II" <...@ldsys.net>
Subject Re: Transaction Retry Problems (AMQ4 Snapshot)
Date Thu, 13 Apr 2006 17:44:13 GMT
John Pederzolli wrote:
> 
> Christopher G. Stach II wrote:
>> What happens if you just mark the Tx for rollback instead of throwing a
>> RuntimeException?
>>
> 
> Christopher -
> 
> How exactly would I do that?
> 
> I currently am consuming messages via Jencks and an MDP, so I'm not sure how
> I would accomplish that.
> 
> Any help would be appreciated 
> 
> - John
> 
> 
> --
> View this message in context: http://www.nabble.com/Transaction-Retry-Problems-%28AMQ4-RC3%29-t1406942.html#a3905086
> Sent from the ActiveMQ - User forum at Nabble.com.
> 

If you're generating the RuntimeException manually (explicitly throwing
it to cause this problem), replace it with something like:

Transaction transaction = _transactionManager.getTransaction();

transaction.setRollbackOnly();

(I don't know where you'll get _transactionManager from...)

If you're using Spring, it's easier:

TransactionInterceptor.currentTransactionStatus().setRollbackOnly();

If you're NOT generating the exception manually, just catch the
exception and do one of the above.

-- 
Christopher G. Stach II

Mime
View raw message