Atomikos Forum

Mule, Postgresql (withAtomikos pool), XA transactions

Hi,

I am trying to get JDBC in Mule with Postgresql to participate in an XA transaction with ActiveMQ.  I'm using

Postgresql 8.3.5
Driver postgresql-8.4-701.jdbc4.jar
ActiveMQ 5.2.0
AtomikosTransactionsEssentials-3.5.8

With the config below (using either <spring:bean name="postgresqlLocalhost"...) I get an error like

ERROR 2009-09-19 10:42:35,174 [jmsConnector.receiver.15] org.mule.transaction.XaTransaction: Bound resource org.postgresql.jdbc4.Jdbc4Connection@1cac3fa is neither a MuleXaObject nor XAResource

Note: I'm not bothered about duplicates in the DB - just ensuring that the message gets from JMS to the DB (eventually).  Any help would be greatly appreciated.

Regards,
Geoff

    <spring:beans>

        <spring:bean id="foreverRetryPolicyTemplate"
            class="org.mule.modules.common.retry.policies.ForeverRetryPolicyTemplate"/>

        <spring:bean id="threadingPolicyTemplate"
            class="org.mule.modules.common.retry.policies.AdaptiveRetryPolicyTemplateWrapper">
            <spring:property name="delegate" ref="foreverRetryPolicyTemplate"/>
        </spring:bean>

        <!--<spring:bean name="postgresqlLocalhost" class="com.atomikos.jdbc.AtomikosDataSourceBean"
            init-method="init" destroy-method="close">
            <spring:property name="xaDataSourceClassName" value="org.postgresql.xa.PGXADataSource"/>
            <spring:property name="uniqueResourceName" value="postgres"/>
            <spring:property name="xaProperties">
                <spring:props>
                    <spring:prop key="user">postgres</spring:prop>
                    <spring:prop key="password"/>
                    <spring:prop key="serverName">localhost</spring:prop>
                    <spring:prop key="portNumber">5432</spring:prop>
                    <spring:prop key="databaseName">test</spring:prop>
                </spring:props>
            </spring:property>
            <spring:property name="poolSize" value="5"/>
            <spring:property name="borrowConnectionTimeout" value="60"/>
        </spring:bean>-->

        <spring:bean name="postgresqlLocalhost" class="com.atomikos.jdbc.nonxa.AtomikosNonXADataSourceBean"
            init-method="init" destroy-method="close">
            <spring:property name="uniqueResourceName" value="postgres"/>
            <spring:property name="driverClassName" value="org.postgresql.Driver"/>
            <spring:property name="url" value="jdbc:postgresql://localhost/test"/>
            <spring:property name="user" value="postgres"/>
            <spring:property name="poolSize" value="5"/>
            <spring:property name="borrowConnectionTimeout" value="60"/>
        </spring:bean>

    </spring:beans>
    
    
    <jdbc:connector dataSource-ref="postgresqlLocalhost" name="quake"
        validateConnections="false">
        <jdbc:query key="quake-insert" value="insert into xa_test values ('abcd')"/>
        </jdbc:connector>
    
    <jms:activemq-xa-connector name="jmsConnector" specification="1.1"
        brokerURL="failover:(tcp://localhost:61616)" maxRedelivery="10" >

        <spring:property name="retryPolicyTemplate" ref="threadingPolicyTemplate"/>
    </jms:activemq-xa-connector>
    
    
    <jbossts:transaction-manager />
    
    <model name="JMS-TEST">

        <!-- JMS provider -->
        <service name="jmsService">
            <inbound>
                <jms:inbound-endpoint queue="quake-jms" >
                    <xa-transaction action="ALWAYS_BEGIN" timeout="5000"/>
                </jms:inbound-endpoint>
            </inbound>
            <outbound>
                <pass-through-router>
                    <jdbc:outbound-endpoint queryKey="quake-insert" >
                        <xa-transaction action="ALWAYS_JOIN"/>
                    </jdbc:outbound-endpoint>
                </pass-through-router>
            </outbound>
        </service>
        
    </model>
Geoff Clitheroe Send private email
Saturday, September 19, 2009
 
 
Hi,

This error:

ERROR 2009-09-19 10:42:35,174 [jmsConnector.receiver.15] org.mule.transaction.XaTransaction: Bound resource org.postgresql.jdbc4.Jdbc4Connection@1cac3fa is neither a MuleXaObject nor XAResource

...suggests that this is a Mule limitation rather than an Atomikos one. It doesn't look like Mule supports non-XA resources in a JTA transaction.

HTH
Guy Pardon Send private email
Monday, September 21, 2009
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics