在mule flow中,使用Flow-Ref时无法运行JDBC事务。如果没有使用flow-ref,则相同的事务范围有效。
任何想法?
这是我的配置xml。
<mule xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:jbossts="http://www.mulesoft.org/schema/mule/jbossts" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/ee/jdbc http://www.mulesoft.org/schema/mule/ee/jdbc/current/mule-jdbc-ee.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
http://www.mulesoft.org/schema/mule/jbossts http://www.mulesoft.org/schema/mule/jbossts/current/mule-jbossts.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd">
<spring:beans>
<spring:bean id="JdbcBean1" name="JdbcBean1" class="oracle.jdbc.xa.client.OracleXADataSource">
<spring:property name="user" value="${sample.db.user}"/>
<spring:property name="URL" value="jdbc:oracle:thin:@//${sample.db.host.name}:1521/${sample.db.instance.name}"/>
<spring:property name="password" value="${sample.db.password}"/>
</spring:bean>
</spring:beans>
<jbossts:transaction-manager doc:name="Transaction Manager"/>
<jdbc-ee:connector name="Database" dataSource-ref="JdbcBean1" validateConnections="true" queryTimeout="-1" pollingFrequency="0" doc:name="Database"/>
<flow name="jdbctransactionFlow1" doc:name="jdbctransactionFlow1">
<file:inbound-endpoint path="src/test/resources/input" moveToDirectory="src/test/resources/output" responseTimeout="10000" doc:name="File"/>
<file:file-to-string-transformer doc:name="File to String"/>
<flow-ref name="jdbctransactionFlow2" doc:name="Flow Reference"/>
<file:outbound-endpoint path="src/test/resources/outputResult" outputPattern="output.xml" responseTimeout="10000" doc:name="File"/>
</flow>
<flow name="jdbctransactionFlow2" doc:name="jdbctransactionFlow2">
<logger message="xa start" level="INFO" doc:name="Logger"/>
<transactional action="BEGIN_OR_JOIN" doc:name="Transactional">
<jdbc-ee:outbound-endpoint exchange-pattern="one-way" queryKey="updateTPCCounterType_TPC410" queryTimeout="-1" connector-ref="Database" doc:name="Database">
<jdbc-ee:transaction action="ALWAYS_JOIN"/>
<jdbc-ee:query key="updateTPCCounterType_TPC410" value="${sample.db.query.updateTPCCounterType_TPC}"/>
</jdbc-ee:outbound-endpoint>
<jdbc-ee:outbound-endpoint exchange-pattern="one-way" queryKey="insert_TPCM_POC_HEADER" queryTimeout="-1" connector-ref="Database" doc:name="Database">
<jdbc-ee:transaction action="ALWAYS_JOIN"/>
<jdbc-ee:query key="insert_TPCM_POC_HEADER" value="${sample.db.query.insert_TPCM_POC_HEADER}"/>
</jdbc-ee:outbound-endpoint>
<jdbc-ee:outbound-endpoint exchange-pattern="one-way" queryKey="insert_TPCM_POC_DETAIL" queryTimeout="-1" connector-ref="Database" doc:name="Database">
<jdbc-ee:transaction action="ALWAYS_JOIN"/>
<jdbc-ee:query key="insert_TPCM_POC_DETAIL" value="${sample.db.query.insert_TPCM_POC_DETAIL}"/>
</jdbc-ee:outbound-endpoint>
</transactional>
<logger message="xa end" level="INFO" doc:name="Logger"/>
</flow>
</mule>
我得到的错误:
ERROR 2013-11-22 19:07:45,781 [main] org.mule.module.launcher.application.DefaultMuleApplication:null org.mule.api.lifecycle.InitialisationException:组件尚未正确初始化,没有流量构造。 ...
信息2013-11-22 19:07:45,783 [主要] org.mule.module.launcher.application.DefaultMuleApplication:应用'接收器'从未启动过,无需处理 线程“main”中的异常org.mule.module.launcher.DeploymentInitException:InitialisationException:组件尚未正确初始化,没有流构造。 ...
引起:org.mule.api.config.ConfigurationException:创建名为'testTranscationFlowFlow1'的bean时出错:init方法的调用失败;嵌套异常是org.mule.api.lifecycle.InitialisationException:组件尚未正确初始化,没有流构造。 ...
...
引起:org.mule.api.config.ConfigurationException:创建名为'testTranscationFlowFlow1'的bean时出错:init方法的调用失败;嵌套异常是org.mule.api.lifecycle.InitialisationException:组件尚未正确初始化,没有流构造。引用者:org.mule.api.lifecycle.InitialisationException:创建名为'testTranscationFlowFlow1'的bean时出错:调用init方法失败;嵌套异常是org.mule.api.lifecycle.InitialisationException:组件尚未正确初始化,没有流构造。 ...
答案 0 :(得分:0)
为您的流程2尝试以下内容
<flow name="jdbctransactionFlow2"
processingStrategy="synchronous"
doc:name="jdbctransactionFlow2">
上述解决方案针对帖子中提到的问题,即代码在单个流程中工作。但尝试使用flow-ref
时无效。
希望这有帮助。