Thursday, June 20, 2013

VFS Filtering Message based on different Error conditions


<proxy xmlns="http://ws.apache.org/ns/synapse" name="XXX" transports="vfs" statistics="enable" trace="enable" startOnLoad="true">
   <target>
      <inSequence>
         <log level="full">
            <property name="Processing file" expression="$trp:FILE_NAME"/>
         </log>
         <property name="transport.vfs.ReplyFileName" expression="$trp:FILE_NAME" scope="transport"/>
         <property name="fileName" expression="$trp:FILE_NAME" scope="default"/>
         <enrich>
            <source type="body" clone="true"/>
            <target type="property" property="ORGINAL_MESSAGE"/>
         </enrich>
         <send>
            <endpoint>
               <address uri="http://localhost:8089/mockSimpleStockQuoteServiceSoap11Binding" format="soap11"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <filter xmlns:s12="http://www.w3.org/2003/05/soap-envelope" xmlns:ns="http://org.apache.synapse/xsd" xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/" xpath="s11:Body/s11:Fault | s12:Body/s12:Fault">
            <then>
               <enrich>
                  <source type="property" clone="true" property="ORGINAL_MESSAGE"/>
                  <target type="body"/>
               </enrich>
               <log level="custom">
                  <property name="ERROR FTP  ##################" value="eeeeeee"/>
               </log>
               <property name="transport.vfs.ReplyFileName" expression="$ctx:fileName" scope="transport"/>
               <property name="OUT_ONLY" value="true"/>
               <send>
                  <endpoint>
                     <address uri="vfs:file:///home/dushan/onlinesupport/session7/BEBusinessServiceError"/>
                  </endpoint>
               </send>
            </then>
            <else>
               <drop/>
            </else>
         </filter>
      </outSequence>
      <faultSequence>
         <log level="full">
            <property name="MESSAGE" value="Executing default 'fault' sequence"/>
            <property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
            <property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
         </log>
         <enrich>
            <source type="property" clone="true" property="ORGINAL_MESSAGE"/>
            <target type="body"/>
         </enrich>
         <log level="custom">
            <property name="ERROR FTP  ##################" value="eeeeeee"/>
         </log>
         <property name="transport.vfs.ReplyFileName" expression="$ctx:fileName" scope="transport"/>
         <property name="OUT_ONLY" value="true"/>
         <send>
            <endpoint>
               <address uri="vfs:file:///home/dushan/onlinesupport/session7/BEConnectionfail"/>
            </endpoint>
         </send>
      </faultSequence>
   </target>
   <parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
   <parameter name="transport.PollInterval">5</parameter>
   <parameter name="transport.vfs.FileURI">file:///home/dushan/onlinesupport/session7/in</parameter>
   <parameter name="transport.vfs.MoveAfterProcess">file:///home/dushan/onlinesupport/session7/out</parameter>
   <parameter name="transport.vfs.FailedRecordNextRetryDuration">1000</parameter>
   <parameter name="transport.vfs.MoveAfterFailure">file:///home/dushan/onlinesupport/session7/fail123</parameter>
   <parameter name="transport.vfs.Locking">false</parameter>
   <parameter name="transport.vfs.FileNamePattern">.*.xml</parameter>
   <parameter name="transport.vfs.ContentType">application/xml</parameter>
   <parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
   <parameter name="transport.vfs.MaxRetryCount">2</parameter>
   <description>:)</description>
</proxy>
                               

No comments:

Post a Comment