diff options
author | franck cuny <franck@lumberjaph.net> | 2010-05-15 17:41:50 +0200 |
---|---|---|
committer | franck cuny <franck@lumberjaph.net> | 2010-05-15 17:41:50 +0200 |
commit | 4da46759419c5e1500df7e52f9529313358d8699 (patch) | |
tree | 60ade303517e5ee3724f2ef8f6170866ab9414e6 | |
parent | spec for control handler (diff) | |
download | presque-4da46759419c5e1500df7e52f9529313358d8699.tar.gz |
spec for rest queue handler
Diffstat (limited to '')
-rw-r--r-- | lib/presque/RestQueueHandler.pm | 44 |
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. |