Sql server 如何在wso2 esb或wso2 dss中执行数据库事务回滚

Sql server 如何在wso2 esb或wso2 dss中执行数据库事务回滚,sql-server,wso2,esb,wso2dss,Sql Server,Wso2,Esb,Wso2dss,我使用Box_功能插入到三个表中,插入正确,但如果插入表时出现错误,则不会回滚数据 我正在寻找以下挑战的解决方案:创建一组相关的表。它们由主键/外键关系关联,需要更新/插入相关表中的对象。在迭代器中介中插入/更新。当其中一个更新/插入失败时会发生什么情况?是否会回滚所有插入/更新的对象 请给出任何想法或链接或代码片段,使其工作 注:Am使用wso2 esb-4.8.1、wso2 dss-3.2.2和MSSQL数据库 浏览了以下链接: 提前感谢这里您必须实现分布式XA事务。请您参考[1]这篇文

我使用Box_功能插入到三个表中,插入正确,但如果插入表时出现错误,则不会回滚数据

我正在寻找以下挑战的解决方案:创建一组相关的表。它们由主键/外键关系关联,需要更新/插入相关表中的对象。在迭代器中介中插入/更新。当其中一个更新/插入失败时会发生什么情况?是否会回滚所有插入/更新的对象

请给出任何想法或链接或代码片段,使其工作

注:Am使用wso2 esb-4.8.1、wso2 dss-3.2.2和MSSQL数据库

浏览了以下链接:


提前感谢

这里您必须实现分布式XA事务。请您参考[1]这篇文章,它将指导您完成这项工作


[1] 这里您必须实现分布式XA事务。请您参考[1]这篇文章,它将指导您完成这项工作


[1]

当您使用带盒功能时,您必须在所有操作调用中保持相同的会话。否则,它将作为单独的调用进行计算,而不是原子调用。下面是一个示例synapse配置,可用于维护同一会话

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="ESBService"
       transports="https http"
       startOnLoad="true"
       trace="disable">
   <description/>
   <target>
      <inSequence>
         <transaction action="new"/>
         <property name="id" expression="json-eval($.id)"/>
         <property name="userName" expression="json-eval($.userName)"/>
         <property name="firstName" expression="json-eval($.firstName)"/>
         <property name="lastName" expression="json-eval($.lastName)"/>
         <property name="address" expression="json-eval($.address)"/>
         <enrich>
            <source type="body" clone="true"/>
            <target type="property" property="FirstBody"/>
         </enrich>
         <property name="messageType" value="application/xml" scope="axis2"/>
         <header name="Action" value="urn:begin_boxcar"/>
         <payloadFactory media-type="xml">
            <format>
               <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                                 xmlns:dat="http://ws.wso2.org/dataservice">
                  <soapenv:Header/>
                  <soapenv:Body>
                     <dat:begin_boxcar/>
                  </soapenv:Body>
               </soapenv:Envelope>
            </format>
            <args/>
         </payloadFactory>
         <call>
            <endpoint>
               <address uri="http://localhost:9764/services/testService.SOAP11Endpoint/"/>
            </endpoint>
         </call>
         <property name="setCookieHeader" expression="$trp:Set-Cookie"/>
         <property name="Cookie"
                   expression="get-property('setCookieHeader')"
                   scope="transport"/>
         <property name="OUT_ONLY" value="true"/>
         <payloadFactory media-type="xml">
            <format>
               <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                                 xmlns:dat="http://ws.wso2.org/dataservice">
                  <soapenv:Header/>
                  <soapenv:Body>
                     <p:insert_employee xmlns:p="http://ws.wso2.org/dataservice">
                        <xs:UserId xmlns:xs="http://ws.wso2.org/dataservice">$1</xs:UserId>
                        <xs:userName xmlns:xs="http://ws.wso2.org/dataservice">$2</xs:userName>
                        <xs:firstName xmlns:xs="http://ws.wso2.org/dataservice">$3</xs:firstName>
                        <xs:lastName xmlns:xs="http://ws.wso2.org/dataservice">$4</xs:lastName>
                     </p:insert_employee>
                  </soapenv:Body>
               </soapenv:Envelope>
            </format>
            <args>
               <arg evaluator="xml" expression="get-property('id')"/>
               <arg evaluator="xml" expression="get-property('userName')"/>
               <arg evaluator="xml" expression="get-property('firstName')"/>
               <arg evaluator="xml" expression="get-property('lastName')"/>
            </args>
         </payloadFactory>
         <property name="Content-Encoding" scope="transport" action="remove"/>
         <property name="Cookie"
                   expression="get-property('setCookieHeader')"
                   scope="transport"/>
         <call>
            <endpoint>
               <address uri="http://localhost:9764/services/testService.SOAP11Endpoint/"/>
            </endpoint>
         </call>
         <payloadFactory media-type="xml">
            <format>
               <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                                 xmlns:dat="http://ws.wso2.org/dataservice">
                  <soapenv:Header/>
                  <soapenv:Body>
                     <dat:end_boxcar/>
                  </soapenv:Body>
               </soapenv:Envelope>
            </format>
            <args/>
         </payloadFactory>
         <property name="Content-Encoding" scope="transport" action="remove"/>
         <property name="Cookie"
                   expression="get-property('setCookieHeader')"
                   scope="transport"/>
         <call>
            <endpoint>
               <address uri="http://localhost:9764/services/testService.SOAP11Endpoint/"/>
            </endpoint>
         </call>
         <respond/>
      </inSequence>
      <faultSequence>
         <log>
            <property name="END" value="****ROLLBACK****"/>
         </log>
         <transaction action="rollback"/>
         <respond/>
      </faultSequence>
   </target>
</proxy>

功能,您不必跨操作维护会话


谢谢

当您使用带盒功能时,您必须在所有操作调用中保持相同的会话。否则,它将作为单独的调用进行计算,而不是原子调用。下面是一个示例synapse配置,可用于维护同一会话

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="ESBService"
       transports="https http"
       startOnLoad="true"
       trace="disable">
   <description/>
   <target>
      <inSequence>
         <transaction action="new"/>
         <property name="id" expression="json-eval($.id)"/>
         <property name="userName" expression="json-eval($.userName)"/>
         <property name="firstName" expression="json-eval($.firstName)"/>
         <property name="lastName" expression="json-eval($.lastName)"/>
         <property name="address" expression="json-eval($.address)"/>
         <enrich>
            <source type="body" clone="true"/>
            <target type="property" property="FirstBody"/>
         </enrich>
         <property name="messageType" value="application/xml" scope="axis2"/>
         <header name="Action" value="urn:begin_boxcar"/>
         <payloadFactory media-type="xml">
            <format>
               <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                                 xmlns:dat="http://ws.wso2.org/dataservice">
                  <soapenv:Header/>
                  <soapenv:Body>
                     <dat:begin_boxcar/>
                  </soapenv:Body>
               </soapenv:Envelope>
            </format>
            <args/>
         </payloadFactory>
         <call>
            <endpoint>
               <address uri="http://localhost:9764/services/testService.SOAP11Endpoint/"/>
            </endpoint>
         </call>
         <property name="setCookieHeader" expression="$trp:Set-Cookie"/>
         <property name="Cookie"
                   expression="get-property('setCookieHeader')"
                   scope="transport"/>
         <property name="OUT_ONLY" value="true"/>
         <payloadFactory media-type="xml">
            <format>
               <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                                 xmlns:dat="http://ws.wso2.org/dataservice">
                  <soapenv:Header/>
                  <soapenv:Body>
                     <p:insert_employee xmlns:p="http://ws.wso2.org/dataservice">
                        <xs:UserId xmlns:xs="http://ws.wso2.org/dataservice">$1</xs:UserId>
                        <xs:userName xmlns:xs="http://ws.wso2.org/dataservice">$2</xs:userName>
                        <xs:firstName xmlns:xs="http://ws.wso2.org/dataservice">$3</xs:firstName>
                        <xs:lastName xmlns:xs="http://ws.wso2.org/dataservice">$4</xs:lastName>
                     </p:insert_employee>
                  </soapenv:Body>
               </soapenv:Envelope>
            </format>
            <args>
               <arg evaluator="xml" expression="get-property('id')"/>
               <arg evaluator="xml" expression="get-property('userName')"/>
               <arg evaluator="xml" expression="get-property('firstName')"/>
               <arg evaluator="xml" expression="get-property('lastName')"/>
            </args>
         </payloadFactory>
         <property name="Content-Encoding" scope="transport" action="remove"/>
         <property name="Cookie"
                   expression="get-property('setCookieHeader')"
                   scope="transport"/>
         <call>
            <endpoint>
               <address uri="http://localhost:9764/services/testService.SOAP11Endpoint/"/>
            </endpoint>
         </call>
         <payloadFactory media-type="xml">
            <format>
               <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                                 xmlns:dat="http://ws.wso2.org/dataservice">
                  <soapenv:Header/>
                  <soapenv:Body>
                     <dat:end_boxcar/>
                  </soapenv:Body>
               </soapenv:Envelope>
            </format>
            <args/>
         </payloadFactory>
         <property name="Content-Encoding" scope="transport" action="remove"/>
         <property name="Cookie"
                   expression="get-property('setCookieHeader')"
                   scope="transport"/>
         <call>
            <endpoint>
               <address uri="http://localhost:9764/services/testService.SOAP11Endpoint/"/>
            </endpoint>
         </call>
         <respond/>
      </inSequence>
      <faultSequence>
         <log>
            <property name="END" value="****ROLLBACK****"/>
         </log>
         <transaction action="rollback"/>
         <respond/>
      </faultSequence>
   </target>
</proxy>

功能,您不必跨操作维护会话


谢谢

我已经浏览了这个链接,它是关于事务和dbreport中介的。但是我不想使用这个中介,我正在寻找一个内部框,它关心是否发生了一些错误,这意味着它将正确地回滚事务,但在我的情况下不会发生。我已经浏览了这个链接,这一切都是关于事务和dbreport中介的。但我不想使用这些中介,我正在寻找一个盒子里面的东西,不管是否发生了一些错误,这意味着它将正确地回滚事务,但在我的情况下不会发生。