sequences in my ESB
それぞれ「seqDeleteEntry」と「seqInsertEntry」の2つがあります。
シーケンス " seqDeleteEntry
" は、受信した入力に基づいてテーブルからエントリを削除します。
コードスニペット:
<sequence xmlns="http://ws.apache.org/ns/synapse">
<property xmlns:ns="http://org.apache.synapse/xsd" name="propertyName" expression="//Id/text()" scope="default" type="STRING"/>
<transaction action="new"/>
<property name="SET_ROLLBACK_ONLY" value="true" scope="axis2"/>
<dbreport useTransaction="true">
<connection>
<pool>
<password>$pwd</password>
<user>$uname</user>
<url>connectionURL</url>
<driver>$driver</driver>
</pool>
</connection>
<statement>
<sql>
<![CDATA[ delete from tbl_name where column_name = ?]]>
</sql>
<parameter expression="$ctx:propertyName" type="VARCHAR"/>
</statement>
</dbreport>
<sequence key="conf:/seqInsertEntry"/>
</sequence>
シーケンス " seqInsertEntry
" はエントリをテーブルに挿入します。
コードスニペット:
<sequence xmlns="http://ws.apache.org/ns/synapse">
<dbreport useTransaction="true">
<connection>
<pool>
<password>$pwd</password>
<user>$uname</user>
<url>connectionURL</url>
<driver>$driver</driver>
</pool>
</connection>
<statement>
<sql>
<![CDATA[ insert into tbl_name values('value1', 'value2')]]>
</sql>
</statement>
</dbreport>
<transaction action="commit"/>
<send/>
</sequence>
私の質問は: 2 番目のシーケンス ( ) にエントリを挿入している
ときにエラー (たとえば) が発生した場合、前のシーケンス ( ) を使用して削除されたレコードが復元されるように、トランザクションをロールバックする必要があります。Integrity Constraint Violation
seqInsertEntry
seqDeleteEntry
上記のサンプルでトランザクション管理を実装するには、どの構成を追加する必要がありますか?
注:
次のプロパティを設定しようとしましたが、役に立ちません。
<transaction action="new"/>
<property name="SET_ROLLBACK_ONLY" value="true" scope="axis2"/>
そして、(両方のシーケンスで)次の属性を追加し、DBReport
2番目のシーケンス(seqInsertEntry
)の最後にトランザクションをコミットしましたが、それでも役に立ちません。
useTransaction="true"
誰かが私が見逃した設定、または上記のシーケンスに追加する必要がある設定を明確にしてください。
前もって感謝します。