Qore FtpPoller Module Reference 2.1
|
Available classes:
The FtpPoller module implements FTP file polling event data provider classes as well as an abstract class that will poll a remote directory with the FTP protocol and return matching files.
To use the FtpPoller class, subclass it and implement the FtpPoller::FtpPoller::singleFileEvent() and FtpPoller::FtpPoller::postSingleFileEvent() methods.
The data provider classes can be used with the data provider infrastructure, and each of these classes uses the FtpPoller class to perform the actual FTP file polling.
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 FtpPoller::stopNoWait() was called in the event thread because calling FtpPoller::stop() in the event thread would cause an exception to be thrown.
A useful poller class would implement the FtpPoller::singleFileEvent() method which process already- transferred files and the FtpPoller::postSingleFileEvent() by deleting / moving / renaming the files so that they would not be acquired on the next poll.
The FtpPoller 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 FtpPoller::constructor()PO_NO_PROCESS_CONTROL:
in this case the "sleep"
option is required in FtpPoller::constructor()