Swarmage::Drone - The Drone
use Swarmage; Swarmage::Drone->new( queues => [ { module => 'DBI::Generic', config => { connect_info => [ 'dbi:Pg:dbname=swarmage', $username, $password, ... ], taks_types => [ qw(foo bar) ], }, } ], workers => { foo => { module => '+MyWorker', config => { .... } }, # multiple workers bar => [ { module => '+MyWorker2', config => { ... } }, { module => '+MyWorker2', config => { ... } }, ] } ); POE::Kernel->run();
The Drone is responsible for retrieving jobs from the system queue, then launching, and keeping track of workers. It's assumed that a Drone may contain multiple types of Workers, and that these Workers coordinate with each other, thus forming a small cluster of processes that implement a particular logic set.
The Drone uses two sets of queues. One is the Global Queue, which is the queue that is shared amongst Drones. The other is the Local Queue, which is shared between one Drone and one or more Workers belonging to that Drone.
The Global Queue may be implemented in terms of a database, a message queue, or whatever that handles its own non-blocking logic to check for incoming tasks. The Local Queue is implemeted with a simple SQLite database.
When an incoming task is notified by the Queue, the Drone checks the job's type, and dispatches to the appropriate Worker.
To install Swarmage, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Swarmage
CPAN shell
perl -MCPAN -e shell install Swarmage
For more information on module installation, please visit the detailed CPAN module installation guide.