I'm developing a Mule ESB application that uses Hibernate, configured through Spring, in the service component implementations. I'm interested in enlisting inbound jms endpoints, the Hibernate activities occuring in the component, and outbound jms endpoints in an XA transaction. The application will be running in Mule Standalone so I'm using the jbossts integration that Mule provides. I just can't seem to get a handle on the Hibernate configuration (in Spring).
So in my mule config I have this: <jbossts:transaction-manager />
And I have Mule service components configured essentially like this: <service name="transactionalService"> <inbound> <jms:inbound-endpoint ref="input.queue"> <xa-transaction action="BEGIN_OR_JOIN" /> </jms:inbound-endpoint> </inbound> <component> <method-entry-point-resolver> <include-entry-point method="processMessage" /> </method-entry-point-resolver> <spring-object bean="messageHandler" /> </component> <outbound> <pass-through-router> <jms:outbound-endpoint ref="input.queue"> <xa-transaction action="ALWAYS_JOIN" /> </jms:outbound-endpoint> </pass-through-router> </outbound> </service>
I'm using Spring to configure Hibernate like this: <bean id="dataSource" class="oracle.jdbc.xa.client.OracleXADataSource"> <property name="URL" value = "${datasource.url}" /> <property name="user" value="${datasource.username}" /> <property name="password" value="${datasource.password}" /> </bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="hibernateProperties"> <util:properties location="classpath:application/hibernate.properties" /> </property> <property name="packagesToScan" value="com.company.project/" /> </bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> <property name="nestedTransactionAllowed" value="true" /> </bean>
<tx:annotation-driven transaction-manager="transactionManager" />
It's this last part with the transactionManager that I know is wrong but I can't figure out exactly how to change this to lookup the TransactionManager that I'm sure is exposed somehow by jbossts. The XA transactions are working on the jms endpoints but the Hibernate persistence within the service component isn't being enlisted in the transaction.
Has anyone done anything similar and can point me in the right direction?
Thanks Jim
|