Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Some advice on Spring transactions please

452196Jul 3 2011 — edited Jul 4 2011
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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 1 2011
Added on Jul 3 2011
2 comments
417 views