Tuesday, April 2, 2013

VFS Best way to define with fault handlers

The following describes one of the best way that VFS can be configured with proper error handlers,  the idea here is, if the messge failed to deliver to any endpoint defined, then it will be revert back to the origin user defined location.

<proxy xmlns="http://ws.apache.org/ns/synapse" name="XXX" transports="vfs" statistics="enable" trace="enable" startOnLoad="true">
   <target>
      <inSequence>
         <log level="custom">
            <property name="Processing file" expression="$trp:FILE_NAME"/>
         </log>
         <property name="transport.vfs.ReplyFileName" expression="$trp:FILE_NAME" scope="transport"/>
         <property name="OUT_ONLY" value="true"/>
         <property name="ContentType" value="application/pdf" scope="axis2"/>
         <property name="ClientApiNonBlocking" scope="axis2" action="remove"/>
         <send>
            <endpoint>
               <address uri="vfs:ftp://a:a@192.168.43.1:50001/files">
                  <markForSuspension>
                     <retriesBeforeSuspension>2</retriesBeforeSuspension>
                     <retryDelay>1</retryDelay>
                 </markForSuspension>
              </address>
            </endpoint>
         </send>
      </inSequence>
      <faultSequence>
         <log level="custom">
            <property name="ERROR FTP  ##################" value="eeeeeee"/>
         </log>
         <send>
            <endpoint>
              <address uri="vfs:file:///home/dushan/poc/server/4.0.5-pack-new/dushan/fail"/>
           </endpoint>
        </send>
      </faultSequence>
   </target>
   <parameter name="transport.PollInterval">5</parameter>
   <parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
   <parameter name="transport.vfs.FailedRecordNextRetryDuration">5000</parameter>
   <parameter name="transport.vfs.MoveAfterProcess">file:///home/dushan/poc/server/4.0.5-pack-new/dushan/out</parameter>
   <parameter name="transport.vfs.FileURI">file:///home/dushan/poc/server/4.0.5-pack-new/dushan/in</parameter>
   <parameter name="transport.vfs.MoveAfterFailure">file:///home/dushan/poc/server/4.0.5-pack-new/dushan/fail</parameter>
   <parameter name="transport.vfs.FileNamePattern">.*.pdf</parameter>
   <parameter name="transport.vfs.ContentType">application/pdf</parameter>
   <parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
   <parameter name="transport.vfs.MaxRetryCount">2</parameter>
   <description>Amtrust Production</description>
</proxy>



No comments:

Post a Comment