【问题标题】:How to use transaction in WSO2如何在 WSO2 中使用事务
【发布时间】:2014-09-08 07:16:55
【问题描述】:

我在通过 WSO2 将数据插入 sql 时尝试使用事务。但交易不起作用。 我正在写示例代码。

<sequence xmlns="http://ws.apache.org/ns/synapse" name="InsertOrderSequence" onError="myFaultHandler">
   <log level="full"></log>
   <transaction action="new"></transaction>
<dbreport useTransaction="true">
  <connection>
     <pool>
        <dsName>jdbc/sqlserver</dsName>
     </pool>
  </connection>
  <statement>
      <sql>
           insert query 1
      </sql>
     </statement>
     <statement>
        <sql>
             insert query 2
        </sql>
     </statement>
   </dbreport> 
  <transaction action="commit"></transaction>
  </sequence>

  <sequence xmlns="http://ws.apache.org/ns/synapse" name="myFaultHandler">
    <transaction action="rollback"></transaction>
  </sequence>

如果在第一个表中插入成功而在第二个表中不成功,则应该发生该时间回滚但回滚不起作用并且在第一个表中发生数据插入。

请让我知道我哪里做错了。

【问题讨论】:

    标签: sql transactions wso2 wso2esb wso2-am


    【解决方案1】:

    db 报告中介不支持数据库的批量插入和相关写入操作。

    由于这是对单个数据库表的批量插入,因此您必须使用数据服务功能来完成此操作。

    在 WSO2 数据服务中提供了批量插入功能,它为您提供了实现此任务的功能。

    因此,您可以在 ESB 之上安装数据服务功能,并创建一个启用批量插入选项的数据服务,如 [1] 中所示。然后从 ESB 调用数据服务。

    [1]http://pushpalankajaya.blogspot.com/2014/02/wso2-dss-batch-insert-sample-end-to-end.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-06-24
      • 1970-01-01
      • 2013-05-30
      • 1970-01-01
      • 2014-01-08
      • 2019-11-01
      • 1970-01-01
      相关资源
      最近更新 更多