summary refs log tree commit diff
path: root/eg/simple.pl
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-05-15 14:28:42 +0200
committerfranck cuny <franck@lumberjaph.net>2010-05-15 14:28:42 +0200
commitde8d333b8806b4a1ea0a997f6a916d127eadae4b (patch)
treef3d3c0edba570fb937c9390ad19dfb489f05a210 /eg/simple.pl
parentfetch job from queue, handle job, handle failure, ... (diff)
downloadpresque-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.pl24
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;