Requirement:- Pick the files from server which has been modified 5 mins before and moved to local server.
I would like to know about the SFTP Client LIST Service in Sterling B2B Integrator it has a parameter "ModificationTime" I want use this to find out the file which are last modified 5 mins before it should be picked and transferred to local server. Can this parameter be helpful.
This is what i am trying
<operation name="SFTP Client LIST Service">
<participant name="SFTPClientList"/>
<output message="SFTPClientListServiceTypeInputMessage">
<assign to="RemoteFileName" from="/ProcessData/Interface/REMOTEFILEPATTERN/text()"/>
<assign to="ModificationTime">300</assign>
<assign to="ResponseTimeout">120</assign>
<assign to="WF_RUNTIME_OVERRIDE_PERSISTENCE_LEVEL">PERSISTENCE_FULL</assign>
<assign to="." from="*"/>
</output>
<input message="inmsg">
<assign to="." from="*"/>
</input>
</operation>
ModificationTime is a output parameter, it was a result from a remote sftp command.
See the sample BP, that list TXT (*.txt) files:
<process name = "Demo_BP_SFTP_List">
<sequence name="Demo_BP_SFTP_List">
<!-- Begin Session -->
<operation name="SFTP Client Begin Session Service">
<participant name="SFTPClientBeginSession"/>
<output message="SFTPClientBeginSessionServiceTypeInputMessage">
<assign to="SFTPClientAdapter">SFTPClientAdapter</assign>
<assign to="RemoteHost">127.0.0.1</assign>
<assign to="RemotePort">22</assign>
<assign to="RemoteUserId">Demo_Remote_SFTP</assign>
<assign to="RemotePasswd">passw0rd</assign>
<assign to="PreferredAuthenticationMethod">password</assign>
<assign to="KnownHostKeyId">442297176384f4ba2node1</assign>
<assign to="." from="*"></assign>
</output>
<input message="inmsg">
<assign to="SFTPClientBeginSessionServiceResults" from="*"></assign>
</input>
</operation>
<operation name="SFTP Client LIST Service">
<participant name="SFTPClientList"/>
<output message="SFTPClientListServiceTypeInputMessage">
<assign to="RemoteFileName">*.txt</assign>
<assign to="SessionToken" from="SFTPClientBeginSessionServiceResults/SessionToken/text()"></assign>
<assign to="." from="*"/>
</output>
<input message="inmsg">
<assign to="SFTPClientLISTServiceResults" from="*"></assign>
</input>
</operation>
<operation name="SFTP Client End Session Service">
<participant name="SFTPClientEndSession"/>
<output message="SFTPClientEndSessionServiceTypeInputMessage">
<assign to="SessionToken" from="SFTPClientBeginSessionServiceResults/SessionToken/text()"></assign>
<assign to="." from="*"></assign>
</output>
<input message="inmsg">
<assign to="SFTPClientEndSessionServiceResults" from="*"></assign>
</input>
</operation>
</sequence>
</process>
The output will be:
</ProcessData>
....
</SFTPClientLISTServiceResults>
....
<Files>
<File>
<Name>testdata01.txt</Name>
<Size>11</Size>
<Type>Regular</Type>
<Permissions>-rw-rw-r--</Permissions>
<ModificationTime>1611017370</ModificationTime>
<Owner>Demo_Remote_SFTP</Owner>
<Group>Demo_Remote_SFTP</Group>
</File>
<File>
<Name>testdata02.txt</Name>
<Size>11</Size>
<Type>Regular</Type>
<Permissions>-rw-rw-r--</Permissions>
<ModificationTime>1611017385</ModificationTime>
<Owner>Demo_Remote_SFTP</Owner>
<Group>Demo_Remote_SFTP</Group>
</File>
<File>
<Name>testdata03.txt</Name>
<Size>12</Size>
<Type>Regular</Type>
<Permissions>-rw-rw-r--</Permissions>
<ModificationTime>1611017399</ModificationTime>
<Owner>Demo_Remote_SFTP</Owner>
<Group>Demo_Remote_SFTP</Group>
</File>
</Files>
</SFTPClientLISTServiceResults>
</ProcessData>
You need to create a loop and check if ModificationTime is less your Current Time minus 5 minutes, and do a SFTP Client GET Service.