PDA

View Full Version : Spring support of JMS Interceptors as opposed to JMSTemplate



vramanlal
Jul 14th, 2005, 05:25 PM
I know I can use JmsTemplate and participate in the JTA transaction. My question is does Spring 1.1.5 support an Interceptor based approach (just like HibernateInterceptor etc) so that I can declare the transaction demarcation in the spring.xml.

Juergen Hoeller
Aug 2nd, 2005, 08:27 AM
Well, HibernateInterceptor is not really an alternative to HibernateTemplate, at least according to common usage patterns. HibernateInterceptor is mainly used to pre-bind specific Hibernate Sessions for a specific invocation scope, for example with specific filters enabled. The DAO itself can still be coded against HibernateTemplate, or alternatively against plain Hibernate3 API.

For transaction demarcation with JMS, you can either use JTA with a transactional JMS provider (as you noted) or Spring's JmsTransactionManager, which performs local transactions as backend for Spring's common transaction demarcation facilities. I don't see how an interceptor could add value here.

Juergen