This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

VFS Transport

The Virtual File System (VFS) transport is used for handling files. It is based on the Apache Commons VFS implementation, so you must include the commons-vfs.jar file in the Carbon classpath to enable the VFS transport. The transport is a module of the Apache Synapse project, and the synapse-vfs-transport.jar file contains the necessary classes, including those that 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"/>

To track failures in file processing, which can occur when a resource becomes unavailable, the VFS transport creates and maintains a failed records file. This text file contains a list of files that failed to be processed. When a failure occurs, an entry with the failed file name and the timestamp is logged in the text file. When the next polling iteration occurs, the VFS transport checks each file against the failed records file, and if a file is listed as a failed record, it will skip processing and schedule a move task to move that file.

To configure a VFS endpoint, use the vfs:file prefix in the URI. For example:

<endpoint>
   <address uri="vfs:file:///home/user/test/out"/>
</endpoint>

The VFS transport also supports the FTPS protocol. The configuration is identical to other protocols with the only difference being the URL prefixes.

VFS Service Level Parameters

The VFS transport does not have any global parameters to be configured. Rather, it has a set of service-level parameters that must be specified for each service.

Parameter Name

Description

Required

Possible Values

Default Value

transport.vfs.
FileURI

The URI where the files you want to process are located.

Yes

A valid file URI in the following form:
file://<path>

 

transport.vfs.
ContentType

Content type of the files processed by the transport.

Yes

A valid content type for the files (e.g., text/xml)

 

transport.vfs.
FileNamePattern

If the VFS listener should process only a subset of the files available at the specified file URI location, use this parameter to select those files by name using a regular expression.

No

A regular expression to select files by name (e.g., *\.xml)

 

transport.
PollInterval

The polling interval for the transport receiver to poll the file URI location. The value is expressed in seconds unless you add "ms" for milliseconds, e.g., "2" or "2000ms" to specify 2 seconds.

No

A positive integer

 

transport.vfs.
ActionAfterProcess

Whether to move or delete the files after the transport has processed them.

No

MOVE or DELETE

DELETE

transport.vfs.
ActionAfterFailure

Whether to move or delete the files if a failure occurs.

No

MOVE or DELETE

DELETE

transport.vfs.
MoveAfterProcess

Where to move the files after processing if ActionAfterProcess is MOVE.

Yes, if
ActionAfterProcess
is MOVE

A valid file URI

 

transport.vfs.
MoveAfterFailure

Where to move the files after processing if ActionAfterFailure is MOVE.

Yes, if
ActionAfterFailure
is MOVE

A valid file URI

 

transport.vfs.
ReplyFileURI

The location where reply files should be written by the transport.

No

A valid file URI

 

transport.vfs.
ReplyFileName

The name for reply files written by the transport.

No

A valid file name

response.xml

transport.vfs.
MoveTimestampFormat

The pattern/format of the timestamps added to file names as prefixes when moving files.

No

A valid timestamp pattern
(e.g., yyyy-MM-dd'T'HH:mm:ss.SSSZ)

 

transport.vfs.
Streaming

Whether files should be transferred in streaming mode

No

true or false

false

transport.vfs.
ReconnectTimeout

Reconnect timeout value in seconds to be used in case of an error when transferring files

No

A positive integer

30 sec

transport.vfs.
MaxRetryCount

Maximum number of retry attempts to carry out in case of errors.

No

A positive integer

3

transport.vfs.Append

When writing the response to a file, whether the response should be appended to the response file instead of overwriting the file. This value should be defined as a query parameter in the out/reply
file URI. For example:
"vfs:file:///home/user/test/out?
transport.vfs.Append=true"

or:

<parameter name="
transport.vfs.ReplyFileURI">
file:///home/user/test/out?
transport.vfs.Append=true
</parameter>

No

true or false

false (the response file will be completely overwritten).

transport.vfs.
MoveAfterFailedMove

Where to move the failed file.

No

A valid file URI

 

transport.vfs.
FailedRecordsFileName

The name of the file that maintains
the list of failed files.

No

A valid file name

vfs-move-failed-records.
properties

transport.vfs.
FailedRecordsFile
Destination

Where to store the failed records file.

No

A folder URI

repository/conf/

transport.vfs.
MoveFailedRecord
TimestampFormat

Entries in the failed records file include the name of the file that failed and the timestamp of its failure. This property configures the time stamp format.

No

A valid timestamp pattern
(e.g., yyyy-MM-dd'T'HH:mm:ss.SSSZ)

dd-MM-yyyy HH:mm:ss

transport.vfs.
FailedRecordNext
RetryDuration

The time in milliseconds to wait before retrying the move task.

No

A positive integer

3000 milliseconds

transport.vfs.Locking

By default, file locking is enabled in the VFS transport. This parameter lets you configure the locking behavior on a per service basis. You can also disable locking globally by specifying the parameter at the receiver level and selectively enable locking only for a set of services.

No

enable or disable

enable

For more information, see:

Â