Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
174 views
in Technique[技术] by (71.8m points)

edi - SFTP Client LIST service parameter "ModificationTime"

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>
question from:https://stackoverflow.com/questions/65831818/sftp-client-list-service-parameter-modificationtime

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...