Question

i am testing some sample use cases with WSO2 where the ESB must scan an SFTP folder and perform some actions. Here is what i did:

1) I enabled the VFS transport listener in axis2.xml:

<transportReceiver name="vfs" class="org.apache.synapse.transport.vfs.VFSTransportListener"/>
<transportSender name="vfs" class="org.apache.synapse.transport.vfs.VFSTransportSender"/>

2) I inserted the following proxy (i have changed user:pass for obvious reasons) :

<proxy xmlns="http://ws.apache.org/ns/synapse" name="SFTPVFSProxy" transports="vfs" statistics="disable" trace="enable" startOnLoad="true">
   <target>
      <inSequence>
         <log level="full" />
      </inSequence>
   </target>
   <parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
   <parameter name="transport.PollInterval">3</parameter>
   <parameter name="transport.vfs.MoveAfterProcess">vfs:sftp://user:pass@10.254.241.69:22/home/user/sftp/out</parameter>
   <parameter name="transport.vfs.FileURI">vfs:sftp://user:pass@10.254.241.69:22/home/user/sftp/in</parameter>
   <parameter name="transport.vfs.MoveAfterFailure">vfs:sftp://user:pass@10.254.241.69:22/home/user/sftp/out</parameter>
   <parameter name="transport.vfs.FileNamePattern">.*.txt</parameter>
   <parameter name="transport.vfs.ContentType">text/plain</parameter>
   <parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
</proxy>

In both versions 4.5.0 & 4.5.1 nothing is triggered. No output in the log files other than some info that the proxy was successfully deployed. The exact same script works in version 3.0.1.

Furthermore, if i change "sftp" to "ftp" or to local file the listener is triggered normally in v4.X as well which makes me believe it's probably something specific to sftp handling.

Am i doing something wrong or is there a bug in the software?

Thank you in advance,

Thodoris

Was it helpful?

Solution

I think the problem is with the way you have defined the transport.vfs.FileURI property. Assuming your user's username is "user", then when you log in to sftp you go to the /home/user folder. Therefore, try defining the above property as follows.

<parameter name="transport.vfs.FileURI">vfs:sftp://user:pass@10.254.241.69:22/sftp/in</parameter>

or

<parameter name="transport.vfs.FileURI">vfs:sftp://user:pass@10.254.241.69:22/in</parameter>

I cannot say the exact config because I dont know your folder structure. I have tried this in WSO2 ESB 4.0.3 with SFTP. My username was amilaftp. So I defined the property as follows.

<parameter name="transport.vfs.FileURI">vfs:sftp://amilaftp:password@localhost/in?vfs.passive=true</parameter>

When you try with FTP, you need to give the full path as you have done in the configuration you have provided. Thats why it is working for you with FTP in WSO2 ESB 4.X. If this works for you in 4.0.3, this should work in 4.5.x too. I suggest you to try with 4.0.3 first because it has worked for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top