Giter Club home page Giter Club logo

wso2-esb-vfs-mediator's Introduction

WSO2 ESB Vfs Mediator

Build status

What is WSO2 ESB?

WSO2 ESB is an open source Enterprise Service Bus that enables interoperability among various heterogeneous systems and business applications.

Vfs Mediator features

Vfs Mediator is a custom WSO2 ESB mediator for copy/move file operations. It uses the VFS protocol for these operations. VFS mediator provides following configurable fields:

Name Values Description Required field
operation copy/move Either copy or move the files from source to destination. Yes
sourceDirectory file pattern to the directory The source directory for the operation. Yes
targetDirectory file pattern to the directory The target directory for the operation. Yes
archiveDirectory file pattern to the directory The archive directory for the operation. No
filePattern Regex pattern The regex pattern to match file(s) No
createMissingDirectories true/false If true, then archive and target directories and sub directories will be created during operation. The default value for this parameter is false. No
lockEnabled true/false If true, VfsMediator creates a lock file (.lock) in the target directory to indicate to other VfsMediator (or ESB VFS proxy) instances that file is still being written. The default value is true. No
streamingTransfer true/false If true, VfsMediator transfers files in streaming mode. This might be useful with large payloads. The default value is false. No
streamingBlockSize Integer This value defines the buffer block size for streaming transfer. The default value is "1024" (bytes). No
sftpTimeout Integer  Timeout value for SFTP connections  No
retry Integer count attribute for retry count and wait attribute for specifying the wait time (in milliseconds) between retries. Defaults to 3 times and 5 seconds.  No
targetFilenamePrefix String When value or expression attribute is set, uses it as a filename prefix when copying/moving the file to the target directory. No
targetFilenameSuffix String When value or expression attribute is set, uses it as a filename suffix when copying/moving the file to the target directory. No
archiveFilenamePrefix String When value or expression attribute is set, uses it as a filename prefix when archiving the file to the archive directory. No
archiveFilenameSuffix String When value or expression attribute is set, uses it as a filename suffix when archiving the file to the archive directory. No

File system specific options

These options are not specified in mediator configuration as they are applicable to certain file systems only. Instead, they are configured using properties synapse message context ($ctx) scope. The properties must be applied before VFS mediator is used.

Option File system Property name Allowed values Example
Enable passive mode FTP vfs.ftp.passiveMode true/false (Default: false) <property name="vfs.ftp.passiveMode" value="true"/>
Authentication key SFTP vfs.sftp.authKeyPath (any valid local path readable by ESB) <property name="vfs.sftp.authKeyPath" value="/home/wso2/.ssh/custom.key"/>

Usage

1. Get the WSO2 ESB Vfs Mediator jar

You have two options:

a) Add as a Maven/Gradle/Ivy dependency to your project. Get the dependency snippet from here.

b) Download it manually from here.

2. Install the mediator to the ESB

Copy the VfsMediator-x.y.jar to $WSO2_ESB_HOME/repository/components/dropins/.

3. Use it

<vfs xmlns="http://ws.apache.org/ns/synapse">
    <operation value="copy" />
    <sourceDirectory value="tmp://bar" />
    <targetDirectory value="tmp://blaa" />
</vfs>

Example with filePattern

<vfs xmlns="http://ws.apache.org/ns/synapse">
    <operation value="copy" />
    <sourceDirectory value="tmp://bar" />
    <targetDirectory value="tmp://blaa" />
    <filePattern value="filename.txt" />
</vfs>

There are more examples under src/test/resources directory.

Technical Requirements

Usage

  • Oracle Java 7 & 8
  • WSO2 ESB
    • Vfs mediator has been tested with WSO2 ESB versions 4.7.0, 4.8.1 and 5.0.0

Development

  • All above + Maven 3.0.X

Copyright © 2016 Mystes Oy. Licensed under the Apache 2.0 License.

wso2-esb-vfs-mediator's People

Contributors

ernolahtinen avatar esaheikkinen avatar manoj-kristhombu avatar vesapohjola avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

wso2-esb-vfs-mediator's Issues

FileSystemException: Could not determine the size of file ..

In sftp transfer vfs-mediator is trying to get a size of a file to verify the transfer was success but this happens:

at org.apache.commons.vfs2.provider.DefaultFileContent.getSize(DefaultFileContent.java:147)
at fi.mystes.synapse.mediator.vfs.VfsFileTransferUtility.copyFile(VfsFileTransferUtility.java:148)
at fi.mystes.synapse.mediator.vfs.VfsFileTransferUtility.doOperation(VfsFileTransferUtility.java:224)
at fi.mystes.synapse.mediator.vfs.VfsFileTransferUtility.copyFiles(VfsFileTransferUtility.java:67)
at fi.mystes.synapse.mediator.vfs.DefaultVfsOperationDelegate.copy(DefaultVfsOperationDelegate.java:35)
at fi.mystes.synapse.mediator.vfs.VfsCopy.executeImpl(VfsCopy.java:35)
at fi.mystes.synapse.mediator.vfs.AbstractVfsOperation.execute(AbstractVfsOperation.java:116)
at fi.mystes.synapse.mediator.VfsMediator.mediate(VfsMediator.java:88)

If streaming block size not defined (using default), NullPointerException occurs

java.lang.NullPointerException
at fi.mystes.synapse.mediator.vfs.VfsFileTransferUtility.streamFromFileToFile(VfsFileTransferUtility.java:344)
at fi.mystes.synapse.mediator.vfs.VfsFileTransferUtility.moveFile(VfsFileTransferUtility.java:263)
at fi.mystes.synapse.mediator.vfs.VfsFileTransferUtility.doOperation(VfsFileTransferUtility.java:219)
at fi.mystes.synapse.mediator.vfs.VfsFileTransferUtility.moveFiles(VfsFileTransferUtility.java:78)
at fi.mystes.synapse.mediator.vfs.DefaultVfsOperationDelegate.move(DefaultVfsOperationDelegate.java:47)
at fi.mystes.synapse.mediator.vfs.VfsMove.executeImpl(VfsMove.java:35)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.