DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. VFS Transport for WSO2 ESB

VFS Transport for WSO2 ESB

Madhuka  Udantha user avatar by
Madhuka Udantha
CORE ·
Feb. 24, 13 · Interview
Like (0)
Save
Tweet
Share
8.17K Views

Join the DZone community and get the full member experience.

Join For Free
Virtual file system (VFS) is an abstraction layer on top of a more concrete file system.  It allows client applications to access different types of concrete file systems in a uniform way. Virtual File System refers to a file or a group of files[1,2].

Day to day I transfer lot of files. We have a file moving requirement in our Service Oriented Architecture. In IT infrastructure it's a very common requirement. WSO2 ESB has a feature rich file transport which is called VFS transport. This transport is currently used by lot of customers for implementing various file transfer and processing scenarios. The VFS transport uses the versatile Apache Commons-VFS library as the underline library for various file system related operations.  So I will show a simple tutorial on VFS in WSO2 ESB. I will be using WSO2 4.5.0 on windows 7 (64bit).

  • WSO2 ESB's VFS transport considers all file names as URIs.
  • WSO2 ESB acts as file transfer and exchanger between various destinations.
VFS transport configurations Parameters
Parameter Possible value
transport.vfs.FileURI Input source (file or directory)
transport.vfs.ContentType The content type of the file
transport.vfs.FileNamePattern The patten of extension of the file
transport.vfs.MoveAfterProcess Location to move the file after process

Let is start it.
[1] Open file “\wso2esb-4.5.0\repository\conf\axis2\axis2.xml”
[2] And uncomment two lines in axis2.xml
VFSTransportListener and VFSTransportSender
[2] Create File Structure in you file directory for test VFS Transport
image
[3] Start ESB from \wso2esb-4.5.0\bin\wso2server.bat \.sh  and Logto WSO2 esb 4.5.0
[4] Home--> Manage--> Services--> Add--> Proxy Service and Click on "Custom Proxy"
[5]Fill the form by passing the proxy name or just click “switch to source view”
image
[6] Then enter below text on there.
<proxy xmlns="http://ws.apache.org/ns/synapse" name="testVFS" transports="https,http,vfs" statistics="disable" trace="disable" startOnLoad="true">

<!—JUST proxy that is sample1—>
<target>
   <outSequence>
      <send />
   </outSequence>
   <endpoint>
      <address uri="https://127.0.0.1:9443/services/SimpleStockQuoteService" />
   </endpoint>
</target>
   <!--VFS configurations-->
   <parameter name="transport.PollInterval">5</parameter>
   <parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
   <parameter name="transport.vfs.FileURI">file:///F:/test/Orginal/</parameter>
   <parameter name="transport.vfs.MoveAfterProcess">file:///F:/test/Pass/</parameter>
   <parameter name="transport.vfs.MoveAfterFailure">file:///F:/test/Failures/</parameter>
   <parameter name="transport.vfs.FileNamePattern">.*.xml</parameter>
   <parameter name="transport.vfs.ContentType">text/xml</parameter>
   <parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
   <description></description>
</proxy>
[7] Then click ‘save’
image

[8] Start SimpleStockQuoteService in sample of ESB for to test this Proxy

image
[09] You will see below log in WSO2 ESB from VFS proxy services.
image
[10] While we ask only for .xml file is Orignal Dir to move Here is new Location of the files.
imageI
It is you time to try out VFS transport with WSO2 ESB.

NOTE
You can also add those parameters from axis2.xml (\wso2esb-4.5.0-1\wso2esb-4.5.0\repository\conf\axis2\axis2.xml).
<transportReceiver name="vfs" class="org.apache.synapse.transport.vfs.VFSTransportListener">
      <parameter name="transport.PollInterval">5</parameter>
      <parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
      <parameter name="transport.vfs.FileURI">file:///F:/test/Orginal1/</parameter>
      <parameter name="transport.vfs.MoveAfterProcess">file:///F:/test/Pass/</parameter>
      <parameter name="transport.vfs.MoveAfterFailure">file:///F:/test/Failures/</parameter>
      <parameter name="transport.vfs.FileNamePattern">.*.xml</parameter>
      <parameter name="transport.vfs.ContentType">text/xml</parameter>
      <parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
     </transportReceiver>
[1]http://www.ibm.com/developerworks/library/l-sc12/index.html
[2]http://www.arl.wustl.edu/~fredk/Courses/cs523/fall01/Papers/kleiman86vnodes.pdf
[3]http://www.w3schools.com/soap/soap_example.asp


Enterprise service bus File system

Published at DZone with permission of Madhuka Udantha, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Top 5 Java REST API Frameworks
  • An Introduction to Data Mesh
  • Stream Processing vs. Batch Processing: What to Know
  • What Is Policy-as-Code? An Introduction to Open Policy Agent

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: