transactions - Spring 3.1 - DefaultMessageListenerContainer - How to identify errors in ErrorHandler -


info :: have defaultmessagelistener implementation xa transaction. have used messagelistener implementation.

scenario:: xa transaction between db , jms q publish. in case of "data error" in either of them, need "move" source message different q , continue processing rest of messages.

problem:: now, if db transaction fails dataintegrity error (primary key violation) then, xa transaction rolls @ container (and not in messagelistener implementation). original message rolls q, , message listener gets stuck message indefinitely -receiving , failing processing.

how can check exceptions - , handle them differently in container can continue rest of messages.

ginz

well, that's point of xa transaction - either commits or nothing does.

if want database transaction not have bearing on jms transaction, need

@transactional(propagation=propagation.requires_new)  

on method upstream of listener. catch , handle exception in listener , jms transaction commit.

in scenario (unless there other resources involved), don't need xa - need handle (small) possibility of duplicate messages - if db transaction commits , jms transaction not, reason.

see http://www.javaworld.com/javaworld/jw-01-2009/jw-01-spring-transactions.html


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -