Hi All,

<< First Time Post >>

I have been using Perl for some years, but mostly for Regex/ DBI usage and would like to use it provide a solution for sending files over SFTP via a REST API. The reason for this is that we need to send a couple of thousand files to a remote server, which has the following restriction on the SFTP connection:

The team is working on a Java Spring solution to the above . . .. but it taking ages, and l would like to ensure that we have a solution and Perl has always been a faster dev curve for me.

I believe that l need to following:

  1. Process which listens to a socket, and forks/create-a-thread for each request
  2. Create a Pool of SFTP connections with Account ID as the primary key for each
  3. Allow this Pool to be shared amongst other processes
  4. When the SFTP connection is returned to the Pool:
    1. we need to run "version" or "ls" every 25 seconds
    2. wrap the SFTP connection into an object which has a isalive function
  5. Return success/ failure after each request

I can see quite a few Server libraries, which do 1 and 5 above - but don't understand how l could share an Object (pool of SFTP connections between them) ... and then more importantly, how l can ensure that there is a thread/while-loop keeping the connection alive.

If libraries/ approach can be provided with code samples or pseudo code - that will really help get me started.

Help Ye Old Perl Monks of Lore !


In reply to REST API with SFTP Pooling by Sukhster

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.