首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Flow-ref时,JDBC事务未按预期工作

使用Flow-ref时,JDBC事务未按预期工作
EN

Stack Overflow用户
提问于 2013-11-22 21:55:48
回答 1查看 571关注 0票数 0

在mule flow中,我无法在使用Flow-Ref时运行JDBC事务。如果没有使用flow-ref,则相同的事务作用域可以工作。

有什么想法吗?

这是我的配置xml。

代码语言:javascript
复制
<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>

我得到的错误是:

错误2013-11-22 19:07:45,781主org.mule.module.launcher.application.DefaultMuleApplication:空org.mule.api.lifecycle.InitialisationException:组件未正确初始化,没有流结构。..。

INFO 2013-11-22 19:07:45,783主org.mule.module.launcher.application.DefaultMuleApplication:应用程序'Receiver‘从未启动,线程" main“org.mule.module.launcher.DeploymentInitException: InitialisationException中没有要处理的异常:组件未正确初始化,没有流结构。..。

..。

..。

原因:testTranscationFlowFlow1:创建名为“”testTranscationFlowFlow1“”的bean时出错:调用init方法失败;嵌套异常是org.mule.api.lifecycle.InitialisationException:组件未正确初始化,没有流构造: org.mule.api.lifecycle.InitialisationException:在创建名为“”testTranscationFlowFlow1“”的bean时出错:调用init方法失败;嵌套异常是org.mule.api.lifecycle.InitialisationException:组件未正确初始化,没有流构造。“”..。

EN

回答 1

Stack Overflow用户

发布于 2013-11-22 22:34:39

在你的流程中尝试下面的方法2

代码语言:javascript
复制
<flow name="jdbctransactionFlow2"
      processingStrategy="synchronous"
      doc:name="jdbctransactionFlow2">

上面的解决方案是针对帖子中提到的代码在单一流程中工作的问题。但在尝试使用flow-ref时不起作用。

希望这能有所帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20146587

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档