Simple HTTP-based queue server
Simple HTTP-based queue server
Install:
Ensure Go and LevelDB are installed and then run:
$ make
$ sudo make install
Run:
$ queued [options]
Enqueue:
$ curl -X POST http://localhost:5353/:queue -d 'foo'
Append the POSTed data to the end of the specified queue (note that queues are created on-the-fly). The Location header will point to the enqueued item and is of the form http://localhost:5353/:queue/:id.
Dequeue:
$ curl -X POST http://localhost:5353/:queue/dequeue
Dequeue the item currently on the head of the queue. Guaranteed not to return the same item twice unless a completion timeout is specified (see below). The Location header will point to the dequeued item and is of the form http://localhost:5353/:queue/:id. Queued message data is returned in the response body.
Dequeue optionally takes wait and/or timeout query string parameters:
wait=<sec> - block for the specified number of seconds or until there is an item to be read
off the head of the queue
timeout=<sec> - if the item is not completed (see endpoint below) within the specified number of seconds, the item will automatically be re-enqueued (when no timeout is specified the item is automatically completed when dequeued)
Get:
$ curl -X GET http://localhost:5353/:queue/:id
Get a specific item. The header X-Dequeued will be true if the item is currently dequeued and waiting for completion.
Complete:
$ curl -X DELETE http://localhost:5353/:queue/:id
Complete the specified item and destroy it (note that only items dequeued with a timeout can be completed).
Stats:
$ curl -X GET http://localhost:5353/:queue
Get stats about a given queue.
leveldb or memory)WriteOptions::sync)