TheSchwartz::Fireworq - TheSchwartz interface for Fireworq.
package My::App;
use TheSchwartz::Fireworq;
sub work_asynchronously {
my $client = TheSchwartz::Fireworq->new(
server => 'http://localhost:8080', # Fireworq host
worker => 'http://localhost:5000/work', # Your app worker endpoint
);
$client->insert('My::Worker', { @_ });
}
package My::Worker;
use parent qw(TheSchwartz::Worker);
sub work {
my ($class, $job) = @_;
use Data::Dumper;
warn Dumper $job->arg;
$job->completed;
}
# app.psgi
package main;
use Plack::Builder;
my $app = sub { ... };
builder {
enable 'TheSchwartz::Fireworq',
path => '/work';
$app;
};
INA Lintaro tarao.gnn@gmail.com