-
Notifications
You must be signed in to change notification settings - Fork 4
Nests
A nest is a resource that holds or produces jobs. All nests have an arrive method which returns a job when one is found.
A FolderNest is one of the simplest nests. It refers to a directory accessible by Antfarm on the local filesystem. It can be constructed via the createFolderNest method.
Like a folder, but this root directory is automatically managed. You must use the auto_managed_folder_directory option to use this feature. It can be constructed with the createAutoFolderNest method.
var af = new Antfarm({
auto_managed_folder_directory: __dirname + "/automanaged",
});
var hotfolder = af.createAutoFolderNest(["hotfolders", "mail-send"]);
// creates ./automanaged/hotfolders/mail-send
With an S3Nest, you can watch an S3 bucket for new objects every few minutes. It can be constructed via the createS3Nest method.
With an FtpNest, you can watch an FTP directory for new files every few minutes. It can be constructed via the createFtpNest method.
A WebhookNest allows you to listen for HTTP requests. When an HTTP request is received, a new job is triggered. This allows you to integrate external systems into your automation logic. It can be constructed via the createWebhookNest method.
See the Webhooks wiki page for more on their usage.
Nests can be watched by tunnels. When new jobs arrive in the nest, the tunnel will run.
let hotfolder = af.createFolderNest("/Users/dominickpeluso/Desktop/Hotfolder", true);
tunnel.watch(hotfolder);
Jobs can also be easily moved to other nests.
job.move(my_ftp_nest, function(){
// Uploaded
});