Skip to content
Dominick Peluso edited this page Oct 27, 2016 · 9 revisions

Overview

A nest is a resource that holds or produces jobs. All nests have an arrive method which returns a job when one is found.

Types

Folder

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.

Auto managed folder

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

S3

With an S3Nest, you can watch an S3 bucket for new objects every few minutes. It can be constructed via the createS3Nest method.

FTP

With an FtpNest, you can watch an FTP directory for new files every few minutes. It can be constructed via the createFtpNest method.

Webhook

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.

Usage

Tunnel watching

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);

Job moving

Jobs can also be easily moved to other nests.

job.move(my_ftp_nest, function(){
    // Uploaded
});