2
votes

I have 2 questions to WSO2 related to the transaction mediator after read several question in SO like:

  1. How to Manage Transaction across sequences in WSO2 ESB
  2. WSO2 ESB Distributed Transations
  3. In WSO2 ESB 4.7.0 can we do JMS rollback in receiving sequence?

My questions:

  1. Can I use transaction to ssupport the clone mediator? Like I clone a message and send to several sequences, if some sequence produce an error I do a rollback?

  2. All the wso2 samples I see related to transaction mediator use the dbreport mediator, and in this mediator I can specified "useTransaction="true"", can I do the same to another mediators?

For example, in question 1:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="proxy1"
       transports="https,http"
       statistics="enable"
       trace="enable"
       startOnLoad="true">
   <target>
      <inSequence onError="conf:/secuencias/rollbackSequence">
         <transaction action="new"/>
         <clone sequential="true">
            <target sequence="anon">
               <sequence>
                  <payloadFactory media-type="xml">
                     ....
                  </payloadFactory>
                  <send>
                     <endpoint>
                        <address uri="..."/>
                     </endpoint>
                  </send>
               </sequence>
            </target>
            <target sequence="anon">
               <sequence>
                  <payloadFactory media-type="xml">
                    ....
                  </payloadFactory>
                  <send>
                     <endpoint>
                        <address uri="..."/>
                     </endpoint>
                  </send>
               </sequence>
            </target>
            <target sequence="anon">
               <sequence>
                  <payloadFactory media-type="xml">
                    ....
                  </payloadFactory>
                  <send>
                     <endpoint>
                        <address uri="..."/>
                     </endpoint>
                  </send>
               </sequence>
            </target>
         </clone>
         <transaction action="commit"/>
      </inSequence>
      <outSequence>
         <aggregate>
            <completeCondition timeout="5">
               <messageCount min="3" max="3"/>
            </completeCondition>
            <onComplete xmlns:ns="http://org.apache.synapse/xsd"
                        xmlns:p="http://sistema1.empresa1.com"
                        expression="//p:GeneratedKeys/Entry/ID">
               <payloadFactory media-type="xml">
                    ....
               </payloadFactory>
               <send/>
            </onComplete>
         </aggregate>
      </outSequence>
      <faultSequence>
         <transaction action="rollback"/>
         <send/>
      </faultSequence>
   </target>
   <publishWSDL key="conf:/wsdls/....wsdl"/>
   <description/>
</proxy>
1
Jorge, have you figured this one out? We are also running into the same kind of transaction questions here while developing a solution that spans across multiple proxies and sequences.Voicu

1 Answers

0
votes
  1. Unfortunately with the current implementation of WSO2 ESB doesn't support using transaction mediator with clone mediator.

  2. Currently wso2 esb works with transaction mediator to use with the dbreport mediator and there you can "useTransaction="true" as you have mentioned correctly. Other than that you can use transaction with transaction mediator for JMS consumer/ producer scenarios only .