diff options
author | franck cuny <franck@lumberjaph.net> | 2010-05-15 14:28:42 +0200 |
---|---|---|
committer | franck cuny <franck@lumberjaph.net> | 2010-05-15 14:28:42 +0200 |
commit | de8d333b8806b4a1ea0a997f6a916d127eadae4b (patch) | |
tree | f3d3c0edba570fb937c9390ad19dfb489f05a210 /eg/simple.pl | |
parent | fetch job from queue, handle job, handle failure, ... (diff) | |
download | presque-worker-de8d333b8806b4a1ea0a997f6a916d127eadae4b.tar.gz |
a simple worker; a role for the REST interface to presque; reg signals
to shutdown workers; log before starting a task; fork dispatcher (a la resque)
Diffstat (limited to 'eg/simple.pl')
-rw-r--r-- | eg/simple.pl | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/eg/simple.pl b/eg/simple.pl new file mode 100644 index 0000000..ab07c51 --- /dev/null +++ b/eg/simple.pl @@ -0,0 +1,24 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +package myworker; +use Moose; +with 'presque::worker'; + +use YAML::Syck; +sub work { + my ($self, $job) = @_; + warn ">>>je suis $$\n"; + warn Dump $job; + sleep(100); +} + +package main; +my $w = myworker->new( + base_uri => 'http://localhost:5000', + queue_name => 'foo', + fork_dispatcher => 1, +); + +$w->start; |