The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

#!/usr/bin/env perl
use strict;
use lib 'definitions';
use Zing;
=pod explain
- zing-scheduler is a Launcher process, see ./examples/00-zing-launcher ...
- but more specifically it listens to a specific *queue* (i.e. scheduled)
- when an event is received which meets the criteria of an app scheme ...
- the process spawns (i.e. spawn()) the app in a fire-and-forget manner
- note: at present, there isn't any rate-limiting and you *can* exhaust ...
- the process table (fork space)
=cut
my $q = Zing::Queue->new(name => 'scheduled');
$q->drop;
$q->send({scheme => ['MyApp::Once', [], 1]});
$q->send({scheme => ['MyApp::Once', [], 1]});
$q->send({scheme => ['MyApp::Once', [], 1]});
$q->send({scheme => ['MyApp::Once', [], 1]});
$q->send({scheme => ['MyApp::Once', [], 1]});
$q->send({scheme => ['MyApp::Once', [], 1]});
$q->send({scheme => ['MyApp::Once', [], 1]});
$q->send({scheme => ['MyApp::Once', [], 1]});
$q->send({scheme => ['MyApp::Once', [], 1]});
$q->send({scheme => ['MyApp::Once', [], 1]});
my $z = Zing->new(scheme => ['Zing::Scheduler', [], 4]);
$z->start;