activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From drvillo <f.viv...@gmail.com>
Subject JMS and JDBC local transactions?
Date Thu, 16 Nov 2006 16:09:41 GMT

I'm removing the whole XA support from my service, mainly because I don't
really need it (eventual inconsistent states are actually handled natively
by the service itself) and I have been encountering problems that I was
encountering.

I had this problem finding the way to set up local transactions, so even if
I have something currently working I'm not sure wheter it makes sense and
how to improve it.

First of all to remove xa transaction support from jencks+activemq I have:

-modified the connection manager removing the transaction support
-removed the reference from the transaction manager in the JCAConnector
-created a separate pool for jdbc connections (with commons-pool) and
transacted their access through
a TransactionProxyFactoryBean.

A snippet of my beans definition file looks like the following then:

--------------------
    <bean id="transactionContextManager"
class="org.jencks.factory.TransactionContextManagerFactoryBean"/>
    <bean id="geronimo"
class="org.jencks.factory.GeronimoTransactionManagerFactoryBean"/>
    <bean id="transactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
        <property name="userTransaction" ref="geronimo"/>
    </bean>



    <!-- Jencks Connection Manager -->
    <bean id="connectionManager"
class="org.jencks.factory.ConnectionManagerFactoryBean">
        <property name="poolingSupport">
            <bean class="org.jencks.factory.SinglePoolFactoryBean">
          ...
            </bean>
        </property>
    </bean>

...
    <bean id="jmsConnectionFactory"
class="org.springframework.jca.support.LocalConnectionFactoryBean"
depends-on="jmsManagedConnectionFactory">
        <property name="managedConnectionFactory"
ref="jmsManagedConnectionFactory"/>
        <property name="connectionManager" ref="connectionManager"/>
    </bean>

...
    <bean id="inboundConnectorStage1" class="org.jencks.JCAConnector">
        <property name="jcaContainer" ref="jencksJCAContainer"/>
        <property name="activationSpec">
            <bean class="org.apache.activemq.ra.ActiveMQActivationSpec">
                <property name="destination" value="stage1Queue"/>
                <property name="destinationType" value="javax.jms.Queue"/>
            </bean>
        </property>
        <property name="ref" value="stage1"/>
    </bean>
...

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
...
    </bean>

    <bean id="wdService"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
        <property name="transactionManager">
            <ref bean="transactionManager"/>
        </property>
        <property name="target">
            <ref bean="wdServiceTarget"/>
        </property>
        <property name="transactionAttributes">
            <props>
                <prop key="*">PROPAGATION_REQUIRED</prop>

            </props>
        </property>
    </bean>
--------------------

My questions here is:
is there any way to get JDBC connections from the connection manager? I
don't quite know how I could wire this together. 
While Xa transactions seems to be on everybody's mouth around, there's
little to no documentation on how to 
get an efficient system with local transactions only...

Thanks everybody
cheers
Francesco

-- 
View this message in context: http://www.nabble.com/JMS-and-JDBC-local-transactions--tf2644032.html#a7380945
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message