This content has been marked as final. Show 2 replies
malcolmmc wrote:You should ask spring questions in a spring specific forum.
I have a pretty straightforward program that uses the Spring annotation driven transaction thing to manage JMS contexts. I'm currently trying to port it from openMq to activeMQ in the hope of getting a more resilient system. The one we have tends to fall over every few weeks, typically triggered by a database connection problem crashing a broker.
Briefly the program I'm having the most trouble with polls a web service for blocks of data records and republishes them through JMS for local consumption.
I'm somewhat confused about the way the transaction system is handled, and what ConnectionFactory to use. The ActiveMQ documentation recommends using a wrapper of some sort, like CachedConnectionFactory (to avoid constant connect and disconnect) but this seems to trigger problems, in particular a "Transaction was not started" exception on commit.
It's complicated by the fact that I'm using a JMS logging system, which uses the same ConnectionFactory to publish log records on another destination, which may occur inside or outside of the standard transaction. Clearly these logging publications shouldn't be rolled back as part of the main transaction.
1) What do I need to do in my logging handler to force the log records to be published immediately, whether or not a transaction is in progress.
2) What connection factory wrappers are OK with transactions.
3) Should the connection factory reference in the JmsTransactionManager be to the underlying factory, or the wrapper.
4) Do I needs to tell the JmsTemplate that transactions are in use.
5) How do I combine JMS and JPA transactions where necessary.You'll need to configure a driver that supports XA transactions for the JPA datasource and use a JTA compilant transaction manager.
Edited by: r035198x on 03-Jul-2011 09:36