我在wso2 esb中尝试事务管理。我有一个数据库和一个代理来测试事务管理,成功案例工作正常,但失败的情况下它不是支持滚动。
我的代理人:
<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>
&#13;
我的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>
&#13;
可能是什么问题?
注意:我也试过https://docs.wso2.com/display/ESB481/Transaction+Mediator+Example有一个数据库和2个表,但是有MySQL。
答案 0 :(得分:0)
我认为你错过了
<send/>
在故障序列结束时标记。您的故障顺序应如下所示。
<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>