From 4da46759419c5e1500df7e52f9529313358d8699 Mon Sep 17 00:00:00 2001 From: franck cuny Date: Sat, 15 May 2010 17:41:50 +0200 Subject: spec for rest queue handler --- lib/presque/RestQueueHandler.pm | 44 ++++++++++++++++++++++++++++++++--------- 1 file 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 header of the request set to B +=item request -=item +content-type : application/json -the B 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 of the request must be set to B. 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 value should be a date in epoch. + =head2 delete Purge and delete the queue. -- cgit v1.2.3