Qore ssh2 Module
..
|
The SftpPoller module implements an abstract class that will poll a remote directory with the SFTP protocol and return matching files.
To use this class, subclass the SftpPoller class and implement the SftpPoller::SftpPoller::singleFileEvent() and SftpPoller::SftpPoller::postSingleFileEvent() methods.
The following simple example will poll for files and then print out information for the files polled (as well as all info, detail, and debug messages) and exit immediately:
Note that SftpPoller::stopNoWait() was called in the event thread because calling SftpPoller::stop() in the event thread would cause an exception to be thrown.
A useful poller class would implement the SftpPoller::singleFileEvent() method which process already-transferred files and the SftpPoller::postSingleFileEvent() by deleting / moving / renaming the files so that they would not be acquired on the next poll.
The SftpPoller class includes support for running in sandboxed Program objects with the following parse options set:
PO_NO_THREAD_CONTROL:
in this case the "start_thread"
option is required in SftpPoller::constructor()PO_NO_PROCESS_CONTROL:
in this case the "sleep"
option is required in SftpPoller::constructor()