Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

VFS transport Basic Example with WSO2 ESB

DZone's Guide to

VFS transport Basic Example with WSO2 ESB

Free Resource

Discover how Microservices are a type of software architecture where large applications are made up of small, self-contained units working together through APIs that are not dependent on a specific language. Brought to you in partnership with AppDynamics.

"WSO2 ESB has a feature rich file transport which is known as the VFS transport. This transport is currently used by lot of customers for implementing various file transfer and processing scenarios. VFS transport uses the versatile Apache Commons-VFS[1] library as the underline library for various file system related operations. This library provided a rich set of features which allows WSO2 ESB's VFS transport to connect to various types of remote file systems. " [1]
The VFS transport implementation is based on Apache Commons VFS implementation.

Lets try a sample.

Start the Axis2 server and deploy the SimpleStockQuoteService if not already done
You will have to modify the following locations accordingly. Create required folders (in,original,failure) and provide the path.

  <parameter name="transport.vfs.FileURI"></parameter> 
<parameter name="transport.vfs.MoveAfterProcess"></parameter>  
<parameter name="transport.vfs.MoveAfterFailure"></parameter> 
Use the following proxy service.

<proxy xmlns="http://ws.apache.org/ns/synapse" name="StockQuoteProxy2" transports="vfs" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence>
         <send>
            <endpoint>
               <address uri="http://localhost:9000/services/SimpleStockQuoteService" format="soap12" />
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <property name="OUT_ONLY" value="true" />
         <send>
            <endpoint>
               <address uri="vfs:file:///home/achala/supportweek10/failure" />
            </endpoint>
         </send>
      </outSequence>
   </target>
   <parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
   <parameter name="transport.PollInterval">10</parameter>
   <parameter name="transport.vfs.MoveAfterProcess">file:///home/achala/supportweek10/original</parameter>
   <parameter name="transport.vfs.FileURI">file:///home/achala/supportweek10/in</parameter>
   <parameter name="transport.vfs.MoveAfterFailure">file:///home/achala/supportweek10/failure</parameter>
   <parameter name="transport.vfs.FileNamePattern">.*.xml</parameter>
   <parameter name="transport.vfs.ContentType">text/xml</parameter>
   <parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
</proxy>

Uncomment the VFS transport listener and sender (In the axis2.xml ) . Copy a file to the in folder.

Discover the six challenges and best practices in managing microservice performance, brought to you in partnership with AppDynamics.

Topics:

Published at DZone with permission of Achala Chathuranga Aponso, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}