简体   繁体   English

WSO2 ESB无法在与MySQL的交易中回滚

[英]WSO2 ESB not roll backing in transcation with MySQL

I am trying transaction management in wso2 esb. 我正在wso2 esb中尝试事务管理。 I have a single database and a proxy to test transaction management, success case is working properly, but failure case it is not roll backing. 我有一个数据库和一个代理来测试事务管理,成功案例工作正常,但失败案例却没有回滚。

My Proxy: 我的代理:

 <proxy name="a" transports="http https jms" startOnLoad="true"> <description/> <target> <inSequence> <send> <endpoint> <address uri="http://localhost:9000/services/SimpleStockQuoteService"/> </endpoint> </send> </inSequence> <outSequence> <transaction action="new"/> <log level="custom"> <property name="text" value="** Reporting to the Database esbdb**"/> </log> <dbreport useTransaction="true"> <connection> <pool> <dsName>jdbc/db</dsName> </pool> </connection> <statement> <sql>delete from company1 where name =?</sql> <parameter xmlns:m1="http://services.samples/xsd" xmlns:m0="http://services.samples" expression="//m0:return/m1:symbol/child::text()" type="VARCHAR"/> </statement> </dbreport> <log level="custom"> <property name="text" value="** Reporting to the Database esbdb1**"/> </log> <dbreport useTransaction="true"> <connection> <pool> <dsName>jdbc/db</dsName> </pool> </connection> <statement> <sql>INSERT into company2 values (?,'c4',?)</sql> <parameter xmlns:m1="http://services.samples/xsd" xmlns:m0="http://services.samples" expression="//m0:return/m1:symbol/child::text()" type="VARCHAR"/> <parameter xmlns:m1="http://services.samples/xsd" xmlns:m0="http://services.samples" expression="//m0:return/m1:last/child::text()" type="DOUBLE"/> </statement> </dbreport> <transaction action="commit"/> <send/> </outSequence> <faultSequence> <property name="SET_ROLLBACK_ONLY" value="true" scope="axis2"/> <log level="custom"> <property name="Transaction Action" value="Rollbacked"/> </log> <transaction action="rollback"/> </faultSequence> </target> </proxy> 

My master-datasource.xml 我的master-datasource.xml

 <providers> <provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider> </providers> <datasources> <datasource> <name>WSO2_CARBON_DB</name> <description>The datasource used for registry and user manager</description> <jndiConfig> <name>jdbc/WSO2CarbonDB</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:h2:repository/database/WSO2CARBON_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000</url> <username>wso2carbon</username> <password>wso2carbon</password> <driverClassName>org.h2.Driver</driverClassName> <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> </configuration> </definition> </datasource> <datasource> <name>DS1</name> <jndiConfig> <name>jdbc/db</name> </jndiConfig> <definition type="RDBMS"> <configuration> <dataSourceClassName>com.atomikos.jdbc.AtomikosDataSourceBean</dataSourceClassName> <dataSourceProps> <property name="xaDataSourceClassName">com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</property> <property name="uniqueResourceName">jdbc/db</property> <property name="xaProperties.databaseName">esb_sp_sample</property> <property name="xaProperties.user">root</property> <property name="xaProperties.password">root</property> <property name="xaProperties.URL">jdbc:mysql://localhost:3306/esb_sp_sample</property> <property name="poolSize">10</property> </dataSourceProps> </configuration> </definition> </datasource> 

What could be the problem? 可能是什么问题呢?

Note: I have also tried with https://docs.wso2.com/display/ESB481/Transaction+Mediator+Example having one database and 2 tables in it, but with MySQL. 注意:我也尝试使用https://docs.wso2.com/display/ESB481/Transaction+Mediator+Example包含一个数据库和2个表的示例,但使用MySQL。

I think you are missing the 我想你想念的

<send/>

Tag at the end of your fault sequence. 在故障序列的末尾标记。 Your fault sequence should be as follows. 您的故障顺序应如下。

     <faultSequence>
        <property name="SET_ROLLBACK_ONLY" value="true" scope="axis2"/>
        <log level="custom">
           <property name="Transaction Action" value="Rollbacked"/>
        </log>
        <transaction action="rollback"/>
        <send/>
     </faultSequence>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM