Skip to content

Instantly share code, notes, and snippets.

@rossmason
Forked from germanrsolis/gist:1416807
Created March 8, 2012 07:33
Show Gist options
  • Save rossmason/1999414 to your computer and use it in GitHub Desktop.
Save rossmason/1999414 to your computer and use it in GitHub Desktop.
xa-gist-4
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans" xmlns:jdbc="http://www.mulesoft.org/schema/mule/jdbc"
xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:test="http://www.mulesoft.org/schema/mule/test" xmlns:context="http://www.springframework.org/schema/context"
xmlns:jbossts="http://www.mulesoft.org/schema/mule/jbossts"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
http://www.mulesoft.org/schema/mule/jdbc http://www.mulesoft.org/schema/mule/jdbc/3.2/mule-jdbc.xsd
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/3.2/mule-jms.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.2/mule-vm.xsd
http://www.mulesoft.org/schema/mule/test http://www.mulesoft.org/schema/mule/test/3.2/mule-test.xsd
http://www.mulesoft.org/schema/mule/jbossts http://www.mulesoft.org/schema/mule/jbossts/3.2/mule-jbossts.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:property-placeholder location="classpath:jdbc.properties" />
<jbossts:transaction-manager />
<spring:beans>
<spring:bean id="oraDataSource" class="oracle.ucp.jdbc.PoolXADataSourceImpl">
<spring:property name="URL" value="${jdbc.url}" />
<spring:property name="user" value="${jdbc.user}" />
<spring:property name="password" value="${jdbc.pass}" />
<spring:property name="connectionFactoryClassName"
value="oracle.jdbc.xa.client.OracleXADataSource" />
<spring:property name="minPoolSize" value="10" />
<spring:property name="maxPoolSize" value="20" />
<spring:property name="connectionWaitTimeout" value="30" />
</spring:bean>
<spring:bean id="mySqlDataSource"
class="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource">
<spring:property name="url"
value="jdbc:mysql://${mysql.host}:${mysql.port}/${mysql.database}?user=${mysql.user}&amp;password=${mysql.pwd}" />
</spring:bean>
</spring:beans>
<spring:bean id="dbQuerySql" class="java.lang.String">
<spring:constructor-arg>
<spring:value>
SELECT * FROM TEST;
</spring:value>
</spring:constructor-arg>
</spring:bean>
<jdbc:connector name="jdbcConnectorDest" dataSource-ref="oraDataSource">
<jdbc:query key="insert_call" value="CALL INSERT_FIELD ('test')" />
</jdbc:connector>
<jdbc:connector name="jdbcConnectorSource"
dataSource-ref="mySqlDataSource">
<jdbc:query key="selectQuery" value-ref="dbQuerySql" />
</jdbc:connector>
<flow name="main">
<jdbc:inbound-endpoint queryKey="selectQuery"
connector-ref="jdbcConnectorSource" pollingFrequency="10000">
<xa-transaction action="ALWAYS_BEGIN" />
</jdbc:inbound-endpoint>
<test:component logMessageDetails="true" />
<jdbc:outbound-endpoint queryKey="insert_call"
connector-ref="jdbcConnectorDest">
<xa-transaction action="ALWAYS_JOIN" />
</jdbc:outbound-endpoint>
</flow>
</mule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment