TheSchwartz::Simple - Lightweight TheSchwartz job dispatcher using plain DBI
use DBI;
use TheSchwartz::Simple;
my $dbh = DBI->connect(...);
my $client = TheSchwartz::Simple->new([ $dbh ]);
$client->prefix("theschwartz_"); # optional
my $job_id = $client->insert('funcname', $arg);
my $job = TheSchwartz::Simple::Job->new;
$job->funcname("WorkerName");
$job->arg({ foo => "bar" });
$job->uniqkey("uniqkey");
$job->run_after( time + 60 );
$client->insert($job);
my @jobs = $client->list_jobs({ funcname => 'funcname' });
for my $job (@jobs) {
print $job->jobid;
}
TheSchwartz::Simple is yet another interface to insert a new job into
TheSchwartz database using plain DBI interface.
This module is solely created for the purpose of injecting a new
job from web servers without loading additional TheSchwartz and
Data::ObjectDriver modules onto your system. Your schwartz job worker
processes will still need to be implemented using the full featured
TheSchwartz::Worker module,
Tatsuhiko Miyagawa <miyagawa@cpan.org>
This library is free software; you can redistribute it and/or modify it under
the same terms as Perl itself.