As messaging and therefore queues is close to my heart, I’ve been following the discussions on rest-discuss on how to construct a RESTful queue with great interest. The discussion started (as did my thinking on the topic a year or so back) around how ActiveMQ has choosen to implement their REST support, a somewhat broken model as pointed out by Paul Winkler (e.g. non-safe GET, DELETE on queue deletes message rather than the queue).
My favorite model so far is the one suggested by Steve Bjorg, also quite similar to the one described in HTTPLR. In that case you would push messages onto a queue with POST and pop then with a combination of POST and DELETE. To quote from Steve’s email.
To add an item:
POST /queue
Content-Type: application/xml (or whatever a queue item is)
–>
201 Created
Location: http://server.com/queue/itemXYZTo request to pop an item:
POST /queue
Content-Type: application/w-www-form-urlencoded
AckTTL=60 (where AckTTL is the time to acknowledge the queue item or
it becomes available again)
–>
200 Ok
http://server.com/queue/itemABCTo delete a popped item:
DELETE /queue/itemABC
…
Go read the discussion thread as it contains many interesting aspects on this pretty hard problem. Ideas on how to improve the current suggestions is very welcome.
July 10th, 2007 at 12:03 pm
But briefly - I’d *LOVE* a nice, proper, RESTful API to ActiveMQ. I’ve wanted to get the cycles to fix this for the longest time - but as the discussion shows its non trivial, but I am liking the looks of what you suggest.
Ideally I was also thinking we should expose the entire broker as an Atom Publishing Protocol; so an APP client could discover all the queues & topics etc.
September 6th, 2007 at 10:15 am
http://macstrac.blogspot.com/2007/08/pure-restful-api-to-activemq-via.html