The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

TheSchwartz::Simple - Lightweight TheSchwartz job dispatcher using plain DBI

SYNOPSIS

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

DESCRIPTION

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,

AUTHOR

Tatsuhiko Miyagawa <miyagawa@cpan.org>

COPYRIGHT

Six Apart, Ltd. 2008-

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

TheSchwartz