about summary refs log tree commit diff
path: root/lib/presque/RestQueueHandler.pm
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-05-15 17:41:50 +0200
committerfranck cuny <franck@lumberjaph.net>2010-05-15 17:41:50 +0200
commit4da46759419c5e1500df7e52f9529313358d8699 (patch)
tree60ade303517e5ee3724f2ef8f6170866ab9414e6 /lib/presque/RestQueueHandler.pm
parentspec for control handler (diff)
downloadpresque-4da46759419c5e1500df7e52f9529313358d8699.tar.gz
spec for rest queue handler
Diffstat (limited to 'lib/presque/RestQueueHandler.pm')
-rw-r--r--lib/presque/RestQueueHandler.pm44
1 files changed, 35 insertions, 9 deletions
diff --git a/lib/presque/RestQueueHandler.pm b/lib/presque/RestQueueHandler.pm
index d1db977..bffe446 100644
--- a/lib/presque/RestQueueHandler.pm
+++ b/lib/presque/RestQueueHandler.pm
@@ -199,7 +199,21 @@ __END__
 
 =head1 NAME
 
-presque::IndexHandler - a redis based message queue
+presque::RestQueueHandler
+
+=head1 SYNOPSIS
+
+    # insert a new job
+    curl -H 'Content-Type: application/json' -X POST "http://localhost:5000/q/foo" -d '{"key":"value"}'
+
+    # insert a delayed job
+    curl -H 'Content-Type: application/json' -X POST "http://localhost:5000/q/foo?delayed="$(expr `date +%s` + 500) -d '{"key":"value"}'
+
+    # fetch a job
+   curl http://localhost:5000/q/foo
+
+    # purge and delete all jobs for a queue
+    curl -X DELETE http://localhost:5000/q/foo
 
 =head1 DESCRIPTION
 
@@ -207,24 +221,36 @@ presque::IndexHandler - a redis based message queue
 
 =head2 get
 
-Get a JSON object out of the queue.
-
 =head2 post
 
-Insert a new job in the queue. The POST request must:
-
 =over 4
 
-=item
+=item path
+
+/q/queuename
 
-have the B<Content-Type> header of the request set to B<application/json>
+=item request
 
-=item
+content-type : application/json
 
-the B<body> of the request must be a valid JSON object
+content : JSON object
+
+query : delayed, worker_id
+
+=item response
+
+code : 201
+
+content : null
 
 =back
 
+The B<Content-Type> of the request must be set to B<application/json>. The body of the request must be a valid JSON object.
+
+It iss possible to create delayed jobs (eg: job that will not be run before a defined time in the futur).
+
+the B<delayed> value should be a date in epoch.
+
 =head2 delete
 
 Purge and delete the queue.