wso2esb 4.8.0中的事务调解器

时间:2013-12-23 09:31:48

标签: postgresql transactions wso2 wso2esb

我正在使用wso2esb 4.8.0并且我经历了wso2esb文档中给出的这个场景。我想将记录从第一个数据库复制到第二个数据库,一旦我从第一个数据库中删除它们。但是当我把重复的记录放在它既不应该从第一个删除也不应该插入第二个。

我的代理服务:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="Transaction_mediator"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <property name="name"
                   expression="//name/text()"
                   scope="default"
                   type="STRING"/>
         <property name="id"
                   expression="//id/text()"
                   scope="default"
                   type="STRING"/>
         <property name="price"
                   expression="//price/text()"
                   scope="default"
                   type="STRING"/>
         <transaction action="new"/>
         <log level="full">
            <property name="text" value="Reporting to the DB1"/>
         </log>
         <dbreport useTransaction="true">
            <connection>
               <pool>
                  <dsName>DS1</dsName>
               </pool>
            </connection>
            <statement>
               <sql>
            delete from c1 where name=?</sql>
               <parameter expression="get-property('name')" type="VARCHAR"/>
            </statement>
         </dbreport>
         <log level="full">
            <property name="text" value="Reporting to the DB2"/>
         </log>
         <dbreport useTransaction="true">
            <connection>
               <pool>
                  <dsName>DS2</dsName>
               </pool>
            </connection>
            <statement>
               <sql>
               INSERT into c1 values (?,?,?)</sql>
               <parameter expression="get-property('name')" type="VARCHAR"/>
               <parameter expression="get-property('id')" type="INTEGER"/>
               <parameter expression="get-property('price')" type="INTEGER"/>
            </statement>
         </dbreport>
         <transaction action="commit"/>
         <send/>
      </inSequence>
      <outSequence>
         <log level="full"/>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>

它正常工作,但是当我输入重复记录时发生错误。那时它从第一个删除记录但没有插入第二个数据库。我该怎么办?是他们的任何解决方案?让我知道。

1 个答案:

答案 0 :(得分:0)

事务介体与JDBC存在问题,并且已在wso2 esb issue tracker中报告。因此,这可以在功能发布中修复。