VFS (Virtual File System) transport implementation is a module which belongs to the Apache Synapse project. The following classes implement the listener and sender APIs.
org.apache.synapse.transport.vfs.VFSTransportListener
org.apache.synapse.transport.vfs.VFSTransportSender
To enable the VFS transport, edit the <ESB_HOME>/repository/conf/axis2/axis2.xml
file and uncomment the VFS listener and the VFS sender as follows:
<transportreceiver name="vfs" class="org.apache.synapse.transport.vfs.VFSTransportListener"/> ... <transportSender name="vfs" class="org.apache.synapse.transport.vfs.VFSTransportSender"/>
The necessary classes can be found in the synapse-vfs-transport.jar
file. Unlike the transports described previously, VFS transport does not have any global parameters to be configured. Rather, it has a set of service level parameters that needs to be specified for each service. VFS transport implementation is mainly used and mostly effective in WSO2 ESB.
Starting from version 4.0, VFS transport supports FTPS protocol ( New in version 4.0 ). Configuration is identical to other protocols with the only difference being the URL prefixes.
The VFS transport implementation is based on Apache Commons VFS implementation. Therefore commons-vfs.jar
file should be included in the Carbon classpath to enable the VFS transport.
Since VFS transport deals with file operations there are certain time that these can fail due to unavailability of some resource. In such a case VFS transport is equipped with the following fault handling mechanism.
When a failure occurs in a file object, that will be marked as a fail record and will be moved to location (configured by the user) where move error file objects are kept. The failed record will be maintain inside a text file ( file name is configurable) and the location of that file will be provided by the user. When the next polling iteration is going on, it will check the file against the failed record and if the file is a failed record, it will skip processing and schedule a move task to move that file(the retry duration of the file move task can be configured). This is handle this way because this is random failure in move operation.
VFS Service Level Parameters
Tip
In transport parameter tables, literals displayed in italic mode under the "Possible Values" column should be considered as fixed literal constant values. Those values can be directly put in transport configurations.
Parameter Name | Description | Required | Possible Values | Default Value |
---|---|---|---|---|
transport.vfs. | The file URL from | Yes | A valid file URL |
|
transport.vfs. | Content type of the files | Yes | A valid content |
|
transport.vfs. | If the VFS listener | No | A regular |
|
transport. | The polling interval in | No | A positive integer |
|
transport.vfs. | Action to perform | No | MOVE, | DELETE |
transport.vfs. | Action to perform | No | MOVE, | DELETE |
transport.vfs. | The location to | Required if | A valid file URI |
|
transport.vfs. | The location to | Required if | A valid file URI |
|
transport.vfs. | The location to | No | A valid file URI |
|
transport.vfs. | The name for reply files | No | A valid file | response.xml |
transport.vfs. | The pattern/format | No | A valid timestamp |
|
transport.vfs. | If files should be transferred | No | true, false | false |
transport.vfs. | Reconnect timeout | No | A positive | 30 sec |
transport.vfs. | Maximum number of | No | A positive | 3 |
transport.vfs. | When writing the This should be By default the | No | true, false | false |
transport.vfs. | New destination | No | A valid file URI |
|
transport.vfs. | The file name to maintain | No | A valid file name | vfs-move- |
transport.vfs. | The destination of the | No | A folder URI | repository |
transport.vfs. | When adding record | No | A valid timestamp | dd-MM- |
transport.vfs. | The time in milli | No | A positive | 3000 milli |
transport.vfs.Locking | By-default file locking is | No | enable or disable | enable |
Please, refer Using the file system as transport medium (VFS) on how to use the VFS transport in real world applications.